[[reference-cluster-health]]

////////
===========================================================================================================================
||                                                                                                                       ||
||                                                                                                                       ||
||                                                                                                                       ||
||        ██████╗ ███████╗ █████╗ ██████╗ ███╗   ███╗███████╗                                                            ||
||        ██╔══██╗██╔════╝██╔══██╗██╔══██╗████╗ ████║██╔════╝                                                            ||
||        ██████╔╝█████╗  ███████║██║  ██║██╔████╔██║█████╗                                                              ||
||        ██╔══██╗██╔══╝  ██╔══██║██║  ██║██║╚██╔╝██║██╔══╝                                                              ||
||        ██║  ██║███████╗██║  ██║██████╔╝██║ ╚═╝ ██║███████╗                                                            ||
||        ╚═╝  ╚═╝╚══════╝╚═╝  ╚═╝╚═════╝ ╚═╝     ╚═╝╚══════╝                                                            ||
||                                                                                                                       ||
||                                                                                                                       ||
||    This file is autogenerated, DO NOT send pull requests that changes this file directly.                             ||
||    You should update the script that does the generation, which can be found in:                                      ||
||    https://github.com/elastic/elastic-client-generator-js                                                             ||
||                                                                                                                       ||
||    You can run the script with the following command:                                                                 ||
||       npm run elasticsearch -- --version <version>                                                                    ||
||                                                                                                                       ||
||                                                                                                                       ||
||                                                                                                                       ||
===========================================================================================================================
////////

[discrete]
[[client.cluster.health]]
=== client.cluster.health

The cluster health API returns a simple status on the health of the cluster. 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, and green means that all shards are allocated. The index level status is controlled by the worst shard status. The cluster status is controlled by the worst index status.

{ref}/cluster-health.html[{es} documentation]

[discrete]
==== Function signature

[source,ts]
----
(ClusterHealthRequest, options?): Promise<ClusterHealthResponse>
----

[discrete]
==== ClusterHealthRequest

[pass]
++++
<pre>
++++
interface ClusterHealthRequest extends <<RequestBase>> {
  index?: <<Indices>>
  expand_wildcards?: <<ExpandWildcards>>
  level?: <<Level>>
  local?: boolean
  master_timeout?: <<Duration>>
  timeout?: <<Duration>>
  wait_for_active_shards?: <<WaitForActiveShards>>
  wait_for_events?: <<WaitForEvents>>
  wait_for_nodes?: string | <<integer>>
  wait_for_no_initializing_shards?: boolean
  wait_for_no_relocating_shards?: boolean
  wait_for_status?: <<HealthStatus>>
}

[pass]
++++
</pre>
++++
[discrete]
==== ClusterHealthResponse

[pass]
++++
<pre>
++++
type ClusterHealthResponse = ClusterHealthHealthResponseBody

[pass]
++++
</pre>
++++
