Elasticsearch: commands & resources
1 min readApr 21, 2019
Cluster health status
curl -X GET "localhost:9200/_cat/health?v"
Quick cluster diagnostics
curl -XGET localhost:9200/_cat/shards?h=index,shard,prirep,state,unassigned.reason| grep UNASSIGNED
Index info
# Get index list
curl -XGET localhost:9200/_cat/indices?v# Delete index
curl -XDELETE localhost:9200/<index_name>/
Get cluster settings
curl -X GET "localhost:9200/_cluster/settings?pretty&include_defaults=true"
Cluster nodes upgrade without stopping the service
Turn off shards allocation
curl -XPUT -H 'Content-Type: application/json' 'http://localhost:9200/_cluster/settings?pretty’ -d '{ "transient" : "cluster.routing.allocation.enable" : "none" } }'
Restart/upgrade elasticsearch on node
Turn on shards allocation
curl -XPUT -H 'Content-Type: application/json' 'http://localhost:9200/_cluster/settings?pretty’ -d '{ "transient" : "cluster.routing.allocation.enable" : "all" } }'
Visualize cluster recovery
curl -s -XGET 'localhost:9200/_cat/recovery?v' | grep -v done | awk '{ print $1, $2, $3, $5, $14, $18, $22 }' | column -t
Get statistic of shards destribution
curl -s 'localhost:9200/_cat/allocation?v'