0
0
ElasticsearchConceptBeginner · 3 min read

Elasticsearch Green, Yellow, Red Status Explained

In Elasticsearch, the green, yellow, and red statuses show the health of your cluster. Green means all data is safe and fully available, yellow means some replicas are missing but data is still accessible, and red means some primary data is missing or unavailable.
⚙️

How It Works

Imagine your Elasticsearch cluster as a library with many books (data). The cluster health status tells you how well the library is organized and if all books are available.

Green means every book has a copy on the shelf and backup copies are also in place. You can find any book quickly without worry.

Yellow means all main books are on the shelves, but some backup copies are missing. The library still works fine, but if a main book is lost, you might have trouble.

Red means some main books are missing from the shelves. This is serious because some data is lost or unreachable, and the library cannot serve all requests properly.

💻

Example

This example shows how to check the cluster health status using Elasticsearch's REST API.

http
GET /_cluster/health

# Example response:
{
  "cluster_name": "my_cluster",
  "status": "yellow",
  "number_of_nodes": 3,
  "active_primary_shards": 5,
  "active_shards": 8,
  "relocating_shards": 0,
  "initializing_shards": 0,
  "unassigned_shards": 2
}
Output
{ "cluster_name": "my_cluster", "status": "yellow", "number_of_nodes": 3, "active_primary_shards": 5, "active_shards": 8, "relocating_shards": 0, "initializing_shards": 0, "unassigned_shards": 2 }
🎯

When to Use

Use the green, yellow, and red status to monitor your Elasticsearch cluster's health regularly. If the status is green, your cluster is fully operational and safe.

If it turns yellow, it means some replica shards are not allocated, which is usually okay but should be fixed to avoid data loss if a node fails.

A red status means critical problems with primary shards, and you should act immediately to restore data or fix node issues to prevent data loss.

This status is essential for system administrators and developers to ensure data reliability and cluster performance.

Key Points

  • Green: All primary and replica shards are active and allocated.
  • Yellow: All primary shards are active, but some replicas are missing.
  • Red: Some primary shards are missing or not allocated.
  • Cluster health status helps detect problems early.
  • Regular monitoring prevents data loss and downtime.

Key Takeaways

Green status means your Elasticsearch cluster is fully healthy with all data available.
Yellow status indicates missing replica shards but no data loss yet.
Red status signals missing primary shards and potential data loss.
Check cluster health regularly to maintain data safety and performance.
Act quickly on yellow or red statuses to avoid bigger problems.