Elasticsearch之索引別名

2021-10-07 17:43:36 字數 787 閱讀 1296

有時候我們使用es索引的別名更方便操作,比如不通索引設定相同別名時使用這個別名可以一起查詢(注意只能查詢,即讀操作);別名可以隨時增加、刪除,方便某些時候的訪問。

post

/_aliases}]

}

指定索引saas_product的別名為saas_product_batch_stock。還有更簡便的方式:

put

//_alias/

當然你也可以指定多個索引使用同乙個別名:

post

/_aliases},

}]}

或者這樣寫也行

post

/_aliases}]

}

甚至你也可以模糊匹配來新增索引別名:

post

/_aliases}]

}

需要注意的是別名不能與索引名相同,否則無法新增。

post

/_aliases}]

}

更簡便的方式:

delete

//_alias/

刪除別名的同時也可以新增別名:

post

/_aliases},

}]}

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...