What are cluster health states in Elasticsearch and what causes each?

Answer

Elasticsearch reports cluster health as green, yellow, or red. Green means all primary and replica shards are allocated and active — the cluster is fully operational. Yellow means all primary shards are allocated (data is safe, all search and indexing works), but one or more replica shards are unallocated — typically because you have a single-node cluster and replicas cannot be placed on the same node as their primary. Red means one or more primary shards are unallocated — the cluster is missing data and those shards cannot be searched or written to. Red status triggers immediately when a node goes down before its primary shards' replicas can be promoted. Use GET /_cluster/health?level=shards to identify which specific shards are problematic.