Elasticsearch 多索引的使用

2021-08-09 22:09:34 字數 524 閱讀 4962

在elasticsearch中,一般的查詢都支援多索引。

只有文件api或者別名等不支援多索引操作,因此本篇就翻譯一下多索引相關的內容。

首先,先插入幾條資料:

$ curl -xpost localhost:9200/test1/test/1 -d

''$ curl -xpost localhost:9200/test1/test/2 -d

''$ curl -xpost localhost:9200/test2/test/1 -d

''

這樣,當前的es中就存在兩個索引、三條資料!

最基本的就是這種陣列的風格,比如使用逗號進行分隔:

$ curl -xpost localhost:9200/test1,test2/_search?pretty -d

'}}'

, "hits" :

}, },

} ]}}

ElasticSearch權威指南學習(索引管理)

當我們需要確保索引被建立在適當數量的分片上,在索引資料之前設定好分析器和型別對映。手動建立索引,在請求中加入所有設定和型別對映,如下所示 put my index 你可以通過在 config elasticsearch.yml 中新增下面的配置來防止自動建立索引。action.auto create...

elasticsearch 建立靜態對映索引

所謂靜態對映就是像mysql一樣在建表的時候對各個欄位的屬性進行設定 put books process settings 建立索引為 books 型別為 it以上索引的it型別 進行資料插入時,只要是字段不是title,process都會報錯 properties number user id c...

Elasticsearch 使用集群 建立索引

elasticsearch 修改資料 elasticsearch 搜尋資料 現在讓我們建立乙個名為 customer 的索引,然後再次列出所有索引 api格式 put customer?pretty get cat indices?v第乙個命令使用put建立名為 customer 的索引。末尾追加p...