Elasticsearch Elasticsearch Health Check Curl

By Opster Expert Team - May 2023

Updated: May 23, 2023

| 2 min read

In addition to reading this guide, we recommend you run the Elasticsearch Health Check-Up. It will detect issues and improve your Elasticsearch performance by analyzing your shard sizes, threadpools, memory, snapshots, disk watermarks and more.

The Elasticsearch Check-Up is free and requires no installation.

Before you begin reading this guide, we recommend you try running the Elasticsearch Error Check-Up which analyzes 2 JSON files to detect many configuration errors.

To easily resolve issues in your deployment, try AutoOps for Elasticsearch. It diagnoses problems by analyzing hundreds of metrics collected by a lightweight agent and offers guidance for resolving them.

Quick Links

Elasticsearch Health Check with cURL


Monitoring the health of your Elasticsearch cluster is crucial to ensure its smooth operation and to detect potential issues before they escalate into problems. One common method to perform a health check is by using cURL, a command-line tool for making HTTP calls. In this article, we will discuss how to use cURL to check the health of your Elasticsearch cluster.

Checking Cluster Health

To check the overall health of your Elasticsearch cluster, you can use the `_cluster/health` endpoint. This endpoint provides information about the cluster’s status, number of nodes, shards, and more. Here’s an example of a cURL command to check the cluster health:

curl -X GET "http://localhost:9200/_cluster/health?pretty"
  "cluster_name" : "my-cluster",
  "status" : "green",
  "timed_out" : false,
  "number_of_nodes" : 3,
  "number_of_data_nodes" : 3,
  "active_primary_shards" : 100,
  "active_shards" : 200,
  "relocating_shards" : 0,
  "initializing_shards" : 0,
  "unassigned_shards" : 0,
  "delayed_unassigned_shards" : 0,
  "number_of_pending_tasks" : 0,
  "number_of_in_flight_fetch" : 0,
  "task_max_waiting_in_queue_millis" : 0,
  "active_shards_percent_as_number" : 100.0

This command will return a JSON object with various details about the cluster. The `status` field indicates the overall health of the cluster, which can be one of three values: “green”, “yellow”, or “red”. A “green” status means that all primary and replica shards are allocated, “yellow” means that all primary shards are allocated but some replica shards are not, and “red” means that at least one primary shard is not allocated.

Checking Index Health

If you want to check the health of a specific index, you can use the `_cluster/health/{index}` endpoint. Replace `{index}` with the name of the index you want to check. For example, to check the health of an index named “my_index”, use the following cURL command:

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

This command will return the same JSON object as above with information about the specified index, including its health status.

Checking Node Health

To check the health of individual nodes in your Elasticsearch cluster, you can use the `_cat/nodes` endpoint. This endpoint provides a detailed overview of each node, including its role, heap usage, CPU usage, and more. Use the following cURL command to check node health:

curl -X GET "http://localhost:9200/_cat/nodes?v&h=name,role,heap.percent,cpu,load_1m,status"
name                role  heap.percent cpu load_1m
instance-0000000121 hirst           22  29    2.03
instance-0000000108 hirst           54  35    3.92
instance-0000000122 hirst           63  34    7.27
instance-0000000126 mr              57   2    1.23

This command will return a tabular output with the specified columns, giving you an overview of the health and performance of each node in your cluster.


In conclusion, using cURL to check the health of your Elasticsearch cluster is a simple and effective method to monitor its status and detect potential issues. Regularly checking the health of your cluster can help you maintain its performance and prevent problems that could impact your applications and 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?

Analyze your cluster & get personalized recommendations

Skip to content