You can also use the API to get the health status of only specified data streams and indices. For data streams, the API retrieves the health status of the stream’s backing indices.
The cluster health status is: green, yellow or red. On the shard level, a red status indicates that the specific shard is not allocated in the cluster. Yellow means that the primary shard is allocated but replicas are not. Green means that all shards are allocated. The index level status is controlled by the worst shard status.
One of the main benefits of the API is the ability to wait until the cluster reaches a certain high watermark health level. The cluster status is controlled by the worst index status.
Required authorization
- Cluster privileges:
monitor,manage
Query parameters
-
Expand wildcard expression to concrete indices that are open, closed or both.
Values are
all,open,closed,hidden, ornone. -
Return health information at a specific level of detail.
Values are
cluster,indices, orshards. -
If true, retrieve information from the local node only. If false, retrieve information from the master node.
-
The period to wait for a connection to the master node. If no response is received before the timeout expires, the request fails and returns an error.
Values are
-1or0.External documentation -
The period to wait for a response. If no response is received before the timeout expires, the request fails and returns an error.
Values are
-1or0.External documentation -
Wait for the specified number of active shards. Use
allto wait for all shards in the cluster to be active. Use0to not wait.Values are
allorindex-setting. -
Wait until all currently queued events with the given priority are processed.
Values are
immediate,urgent,high,normal,low, orlanguid. -
Wait until the specified number (N) of nodes is available. It also accepts
>=N,<=N,>Nand<N. Alternatively, use the notationsge(N),le(N),gt(N), andlt(N). -
Wait (until the timeout expires) for the cluster to have no shard initializations. If false, the request does not wait for initializing shards.
-
Wait (until the timeout expires) for the cluster to have no shard relocations. If false, the request not wait for relocating shards.
-
Wait (until the timeout expires) for the cluster to reach a specific health status (or a better status). A green status is better than yellow and yellow is better than red. By default, the request does not wait for a particular status.
Values are
green,GREEN,yellow,YELLOW,red,RED,unknown, orunavailable.
curl \
--request GET 'http://api.example.com/_cluster/health'
{
"cluster_name" : "testcluster",
"status" : "yellow",
"timed_out" : false,
"number_of_nodes" : 1,
"number_of_data_nodes" : 1,
"active_primary_shards" : 1,
"active_shards" : 1,
"relocating_shards" : 0,
"initializing_shards" : 0,
"unassigned_shards" : 1,
"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": 50.0
}