elasticsearch/es-cluster-health

Check Cluster Health

Get overall Elasticsearch cluster health

elasticsearch
cluster
health

Command

curl -X GET 'http://localhost:9200/_cluster/health?pretty'

Explanation

Retrieves the health status of the entire Elasticsearch cluster. It indicates whether the cluster is operational and if all primary and replica shards are allocated properly.

Common Use Cases

  • Monitoring cluster status and stability
  • Diagnosing shard allocation issues
  • Integrating health checks into alerting systems

Best Practices

  • Regularly check cluster health in production environments
  • Integrate with monitoring tools such as Kibana or Prometheus

Common Mistakes to Avoid

  • Forgetting to include `?pretty` for readable output
  • Not specifying `level=shards` when detailed shard information is required

Troubleshooting

Problem: Cluster shows 'red' status

Solution: Check unassigned shards with `_cat/shards` and reallocate missing indices.

Problem: Timeouts during health check

Solution: Increase cluster availability or verify node connectivity.

Examples

Cluster health with shard details

curl -X GET 'http://localhost:9200/_cluster/health?level=shards&pretty'