Get the cluster health status
/_cluster/health 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
Parameters
query Query Parameters
| Name | Type |
|---|---|
expand_wildcards Expand wildcard expression to concrete indices that are open, closed or both. | type TypesExpandWildcards = type TypesExpandWildcard = "all" | "open" | "closed" | "hidden" | "none" | type TypesExpandWildcard = "all" | "open" | "closed" | "hidden" | "none"[] |
level Return health information at a specific level of detail. | type TypesLevel = "cluster" | "indices" | "shards" |
local If true, retrieve information from the local node only. If false, retrieve information from the master node. | boolean |
master_timeout 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. | type TypesDuration = string | "-1" | "0" |
timeout The period to wait for a response. If no response is received before the timeout expires, the request fails and returns an error. | type TypesDuration = string | "-1" | "0" |
wait_for_active_shards Wait for the specified number of active shards.
Use | type TypesWaitForActiveShards = type TypesWaitForActiveShardOptions = "all" | "index-setting" | number |
wait_for_events Wait until all currently queued events with the given priority are processed. | type TypesWaitForEvents = "immediate" | "urgent" | "high" | "normal" | "low" | "languid" |
wait_for_nodes Wait until the specified number (N) of nodes is available.
It also accepts | type ClusterHealthWaitForNodes = string | number |
wait_for_no_initializing_shards Wait (until the timeout expires) for the cluster to have no shard initializations. If false, the request does not wait for initializing shards. | boolean |
wait_for_no_relocating_shards Wait (until the timeout expires) for the cluster to have no shard relocations. If false, the request not wait for relocating shards. | boolean |
wait_for_status 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. | type TypesHealthStatus = "green" | "GREEN" | "yellow" | "YELLOW" | "red" | "RED" | "unknown" | "unavailable" |
Responses
active_primary_shards: number;
active_shards: number;
active_shards_percent?: string;
active_shards_percent_as_number: number;
cluster_name:
delayed_unassigned_shards: number;
indices?: { };
initializing_shards: number;
number_of_data_nodes: number;
number_of_in_flight_fetch: number;
number_of_nodes: number;
number_of_pending_tasks: number;
relocating_shards: number;
status:
task_max_waiting_in_queue?:
task_max_waiting_in_queue_millis:
timed_out: boolean;
unassigned_primary_shards: number;
unassigned_shards: number;
}