一、_cluster系列
1、查詢設置集羣狀態
curl -XGET localhost:9200/_cluster/health?pretty=true
pretty=true表示格式化輸出
level=indices 表示顯示索引狀態
level=shards 表示顯示分片信息
2、顯示集羣系統信息,包括CPU JVM等等
curl -XGET localhost:9200/_cluster/stats?pretty=true
3、集羣的詳細信息。包括節點、分片等。
curl -XGET localhost:9200/_cluster/state?pretty=true
4、獲取集羣堆積的任務
curl -XGET localhost:9200/_cluster/pending_tasks?pretty=true
5、查看節點信息
curl XGET localhost:9200/_cat/nodes?v
二、_cat系列
1、_cat系列提供了一系列查詢elasticsearch集羣狀態的接口。你可以通過執行
curl -XGET localhost:9200/_cat
2、獲取所有_cat系列的操作,你也可以後面加一個v,讓輸出內容表格顯示錶頭
=^.^=
/_cat/allocation
/_cat/shards
/_cat/shards/{index}
/_cat/master
/_cat/nodes
/_cat/indices
/_cat/indices/{index}
/_cat/segments
/_cat/segments/{index}
/_cat/count
/_cat/count/{index}
/_cat/recovery
/_cat/recovery/{index}
/_cat/health
/_cat/pending_tasks
/_cat/aliases
/_cat/aliases/{alias}
/_cat/thread_pool
/_cat/plugins
/_cat/fielddata
/_cat/fielddata/{fields}
三、索引操作
1、獲取索引
curl -XGET localhost:9200/{index}/{type}/{id}
2、索引數據
curl -XPOST localhost:9200/{index}/{type}/{id}’ -d'{“a”:”avalue”,”b”:”bvalue”}
3、刪除索引
curl -XDELETE localhost:9200/{index}/{type}/{id}
四、mapping操作
1、設置mapping
curl -XPUT localhost:9200/{index}/{type}/_mapping -d '{
"{type}" : {
"properties" : {
"date" : {
"type" : "long"
},
"name" : {
"type" : "string",
"index" : "not_analyzed"
},
"status" : {
"type" : "integer"
},
"type" : {
"type" : "integer"
}
}
}
}'
2、獲取mapping
curl -XGET localhost:9200/{index}/{type}/_mapping