Elasticsearch 9 cheatsheet
Elasticsearch 9: Cluster and health
6 common Elasticsearch 9 tasks.
Check that the cluster is up
Return the cluster name and Elasticsearch version. Set ELASTIC_PASSWORD first, and point --cacert at your cluster's CA certificate.
curl -u elastic:$ELASTIC_PASSWORD --cacert http_ca.crt "https://localhost:9200"
Check cluster health
Show the status: green, yellow or red.
curl -u elastic:$ELASTIC_PASSWORD --cacert http_ca.crt "https://localhost:9200/_cluster/health?pretty"
List nodes
Show nodes with their roles, load and memory.
curl -u elastic:$ELASTIC_PASSWORD --cacert http_ca.crt "https://localhost:9200/_cat/nodes?v"
List indices
Show indices with health, document counts and size.
curl -u elastic:$ELASTIC_PASSWORD --cacert http_ca.crt "https://localhost:9200/_cat/indices?v"
List shards
Show where every shard is allocated.
curl -u elastic:$ELASTIC_PASSWORD --cacert http_ca.crt "https://localhost:9200/_cat/shards?v"
Explain unassigned shards
Ask why a shard is not allocated.
curl -u elastic:$ELASTIC_PASSWORD --cacert http_ca.crt "https://localhost:9200/_cluster/allocation/explain?pretty"