elasticserch常用命令api
集群
curl -XGET 'localhost:9200/_cluster/health?pretty=true' 集群健康
curl -XGET 'localhost:9200/_cluster/settings?pretty=true' 集群設(shè)置
curl -XGET 'localhost:9200/_cluster/health?level=indices&pretty=true' 集群健康-列出索引
curl -XPUT 'localhost:9200/_cluster/settings' -H 'Content-Type:application/json' -d '{"transient":{"cluster":{"max_shards_per_node":4000}}}'
curl -XPUT 'localhost:9200/_cluster/settings' -H 'Content-Type:application/json' -d '{"persisent":{"cluster":{"max_shards_per_node":4000}}}' 更新集群setting 分片上限
分片
curl -XGET 'localhost:9200/_cluster/allocation/explain?pretty' 未分片詳情
curl -XGET 'localhost:9200/_cat/shards?v' 索引分片詳情列表
curl -XGET 'localhost:9200/_cat/shards?h=index,shard,prirep,state,unassigned.reason' 索引分片列表指定字段
curl -XGET 'localhost:9200/_cat/allocation?v' 集群分片詳情
索引
curl -XGET 'localhost:9200/_cat/indices?v' 查看索引列表
curl -XGET 'localhost:9200/_cat/indices?index=*2020.0707*' 模糊查詢索引列表
curl -XGET 'localhost:9200/.kibana_1/setting' 查看索引配置
curl -XDELETE 'localhost:9200/index_name' 刪除
curl -XGET 'localhost:9200/_cluster/health/index_name?pretty' 索引健康
curl -XGET 'localhost:9200/_cat/segments/index_name?v' 索引segments
curl -XPUT 'localhost:9200/index_name/_settings' -H 'Content-Type:application/json' -d '{"number_of_replicas":0}' 更新索引setting設(shè)置
curl -XPUT 'localhost:9200/index_name' -H 'Content-Type:application/json' -d '{"setting":{"number_of_shards":1,"number_of_replicas":1}}' 新建索引-指定主從分片數(shù)
curl -XPUT 'localhost:9200/index_name/_doc/1' -H 'Content-Type:application/json' -d '{"id":1001}' 索引下新建文檔
curl -XGET 'localhost:9200/index_name/_search?size=10' 查詢10條索引
curl -XGET 'localhost:9200/index_name/_search?size=10&pretty' -H 'Content-Type:application/json' -d '{"query":{"term":{"id":"1001"}}}' term 精確匹配查詢
curl -XGET 'localhost:9200/index_name/_search?size=10&pretty' -H 'Content-Type:application/json' -d '{"query":{"match":{"id":"1001"}}}' match 分詞匹配查詢
curl -XGET 'localhost:9200/index_name/_search?size=10&pretty&q=id:1001' url傳參查詢
curl -XGET 'localhost:9200/index_name/index_name/1001?pretty' /_index/_type/_id 查詢索引詳情
線程池
curl -XGET 'localhost:9200/_cat/thread_pool/write?v' 線程池信息
curl -XGET 'localhost:9200/_nodes/stats/pretty' > 1.txt 節(jié)點(diǎn)詳情(有線程池信息)
快照
curl -XPUT 'localhost:9200/_snapshot/es_backup' -H 'Content-Type:application/json' -d '{"type":"fs","setting":{"location":"/data/es_backup","compress":true}}' 創(chuàng)建倉(cāng)庫(kù)
curl -XPUT 'localhost:9200/_snapshot/es_backup/snapshot_all' 備份所有-增量
curl -XPUT 'localhost:9200/_snapshot/es_backup/snapshot_001' -d '{"indices":"index_name"}' -H 'Content-Type:application/json' 備份指定索引
curl -XGET 'localhost:9200/_snapshot/es_backup/_all' 查詢所有快照
curl -XGET 'localhost:9200/_snapshot/es_backup/snapshot_001/_status' 查詢某快照狀態(tài)
curl -XDELETE 'localhost:9200/_snapshot/es_backup/snapshot_001' 刪除快照
curl -XPOST 'localhost:9200/_snapshot/es_back/snapshot_001/_restore' 恢復(fù)
posted on 2022-01-25 17:06 2042穿越而來 閱讀(252) 評(píng)論(0) 收藏 舉報(bào)
浙公網(wǎng)安備 33010602011771號(hào)