elasticsearch/es-cluster-stats

Cluster Stats

View cluster-wide statistics

elasticsearch
cluster
stats

Command

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

Explanation

Provides a detailed snapshot of the Elasticsearch cluster including node, index, and shard-level metrics such as document counts, memory usage, and storage size.

Common Use Cases

  • Gathering performance metrics for dashboards
  • Capacity planning and scaling decisions
  • Troubleshooting data distribution issues

Best Practices

  • Regularly collect stats for performance baselines
  • Use tools like Metricbeat or OpenTelemetry to ingest stats automatically

Common Mistakes to Avoid

  • Not using `?pretty` which makes output hard to read
  • Confusing `_cluster/stats` with `_cat/indices` which provides index-level info only

Troubleshooting

Problem: High heap memory usage

Solution: Review field data cache and consider adjusting JVM heap size.

Problem: Unbalanced shard allocation

Solution: Review `cluster.routing.allocation` settings or rebalance nodes.

Examples

Cluster stats without pretty print

curl -X GET 'http://localhost:9200/_cluster/stats'