ElasticSearch 獲取es信息以及索引操作


檢查集群的健康情況

GET /_cat/health?v

green:每個索引的primary shard和replica shard都是active狀態的
yellow:每個索引的primary shard都是active狀態的,但是部分replica shard不是active狀態,處於不可用的狀態
red:不是所有索引的primary shard都是active狀態的,部分索引有數據丟失了

快速查看集群中有哪些索引 

GET /_cat/indices?v

創建索引

PUT /test_index

{
   "settings" : {
      "number_of_shards" : 3,
      "number_of_replicas" : 1
   }
}
test_index 表示索引的名稱
number_of_shards 表示分片數
number_of_replicas 表示副本數
成功會返回
{
"acknowledged": true,
"shards_acknowledged": true,
"index": "test_index"
}

刪除索引

DELETE /test_index

 修改索引副本數

PUT /my_temp_index/_settings { "number_of_replicas": 2 }

轉載請注明來自:http://www.cnblogs.com/phpshen/p/8668833.html


免責聲明!

本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。



 
粵ICP備18138465號   © 2018-2025 CODEPRJ.COM