Elasticsearch Elasticsearch Health Check: Monitoring and Troubleshooting Cluster Health

By Opster Team

Updated: Jun 22, 2023

| 2 min read


Maintaining a healthy Elasticsearch cluster is crucial for ensuring optimal performance, stability, and data integrity. In this article, we will discuss various methods to monitor and troubleshoot the health of your Elasticsearch cluster, including using APIs, interpreting health status, and identifying common issues.

Using Cluster Health API

The Cluster Health API is a valuable tool for monitoring the overall health of your Elasticsearch cluster. It provides real-time information about the cluster’s state, including the number of nodes, shards, and indices, as well as the status of each index.

To check the health of your cluster, send a GET request to the following endpoint:

GET /_cluster/health

The response will include a JSON object with information about the cluster’s health. The most important field in the response is the “status” field, which can have one of three values:

  1. “green”: All primary and replica shards are allocated, and the cluster is fully operational.
  2. “yellow”: All primary shards are allocated, but some replica shards are not. The cluster is still operational, but data redundancy may be compromised as well as the search and/or indexing performance that might be degraded.
  3. “red”: Some primary shards are not allocated, which means that some data is inaccessible. The cluster is in a critical state and requires immediate attention.

You can also check the health of specific indices by appending their names to the endpoint:

GET /_cluster/health/index_name

Interpreting Cluster Health Metrics

In addition to the “status” field, the Cluster Health API response includes several other metrics that can help you assess the health of your cluster:

  • “number_of_nodes”: The total number of nodes in the cluster.
  • “number_of_data_nodes”: The number of data nodes in the cluster.
  • “active_primary_shards”: The number of primary shards that are active and serving requests.
  • “active_shards”: The total number of active shards (primary and replica) in the cluster.
  • “relocating_shards”: The number of shards that are currently being relocated to another node.
  • “initializing_shards”: The number of shards that are being initialized.
  • “unassigned_shards”: The number of shards that are not assigned to any node.

By monitoring these metrics, you can identify potential issues and take appropriate actions to maintain a healthy cluster.

Identifying Common Cluster Health Issues

Here are some common issues that can affect the health of your Elasticsearch cluster and how to address them:

  1. Insufficient resources: If your cluster has insufficient resources (CPU, memory, or disk space), it may struggle to handle incoming requests and maintain optimal performance. To resolve this issue, consider adding more nodes to your cluster or upgrading the hardware of existing nodes.
  1. Unassigned shards: If you have unassigned shards, it means that some data is not being served by the cluster. This can happen due to node failures, insufficient resources, or misconfiguration. To address this issue, you can use the Cluster Allocation Explain API to identify the reason for the unassigned shards and take appropriate actions, such as adding more nodes or adjusting the shard allocation settings.
  1. Slow or unresponsive nodes: If some nodes in your cluster are slow or unresponsive, it can lead to increased latency and reduced performance. To identify slow nodes, you can use the Nodes Stats API to monitor various node-level metrics, such as CPU usage, memory usage, and disk I/O. Once you’ve identified the problematic nodes, you can take appropriate actions, such as restarting the nodes, upgrading their hardware, or adjusting their configuration.
  1. Index-level issues: Sometimes, the health of your cluster can be affected by issues at the index level, such as corrupt segments or misconfigured settings. To identify index-level issues, you can use the Indices Stats API to monitor various index-level metrics, such as document count, store size, and indexing rate. If you find any issues, you can take appropriate actions, such as reindexing the data, adjusting the index settings, or deleting and recreating the index.


Regularly monitoring and troubleshooting the health of your Elasticsearch cluster is essential for maintaining optimal performance and data integrity. By using the Cluster Health API and other monitoring tools, you can quickly identify and address potential issues, ensuring a stable and reliable search experience for your users.

How helpful was this guide?

We are sorry that this post was not useful for you!

Let us improve this post!

Tell us how we can improve this post?