---
type: api
title: Get the cluster health status
description: **All methods and paths for this operation:**
url: https://www.elastic.co/elastic/docs-builder/docs/4371/api/doc/elasticsearch/operation/operation-cluster-health
resource: https://www.elastic.co/elastic/docs-builder/docs/4371/api/doc/elasticsearch/operation/operation-cluster-health
products:
  - Elasticsearch
---

# Get the cluster health status


Availability: 1.3+

## Paths

- `GET` `/_cluster/health/{index}`
- `GET` `/_cluster/health`

- [Api key auth](/elastic/docs-builder/docs/4371/api/doc/elasticsearch/authentication#apikeyauth)
- [Basic auth](/elastic/docs-builder/docs/4371/api/doc/elasticsearch/authentication#basicauth)
- [Bearer auth](/elastic/docs-builder/docs/4371/api/doc/elasticsearch/authentication#bearerauth)

#### Path Parameters

- `index` (union IndexName | [] IndexName) — optional, leave it out to use `/_cluster/health`
  A comma-separated list of data streams, indices, and index aliases that limit the request.
Wildcard expressions (`*`) are supported.
To target all data streams and indices in a cluster, omit this parameter or use _all or `*`.

## Description

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 String Parameters

- `expand_wildcards` (string ExpandWildcards · default: all)
  Expand wildcard expression to concrete indices that are open, closed or both.

Supported values include:
  - `all`: Match any data stream or index, including hidden ones.
  - `open`: Match open, non-hidden indices. Also matches any non-hidden data stream.
  - `closed`: Match closed, non-hidden indices. Also matches any non-hidden data stream. Data streams cannot be closed.
  - `hidden`: Match hidden data streams and hidden indices. Must be combined with `open`, `closed`, or `both`.
  - `none`: Wildcard expressions are not accepted.
  Values: `all`, `open`, `closed`, `hidden`, `none`
- `level` (enum Level · default: cluster)
  Return health information at a specific level of detail.
  Values: `cluster`, `indices`, `shards`
- `local` (boolean · default: false)
  If true, retrieve information from the local node only.
If false, retrieve information from the master node.
- `master_timeout` (string Duration · default: 30s)
  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.
- `timeout` (string Duration · default: 30s)
  The period to wait for a response.
If no response is received before the timeout expires, the request fails and returns an error.
- `wait_for_active_shards` (WaitForActiveShards · default: 0)
  Wait for the specified number of active shards.
Use `all` to wait for all shards in the cluster to be active.
Use `0` to not wait.
  Values: `all`, `index-setting`
- `wait_for_events` (enum WaitForEvents)
  Wait until all currently queued events with the given priority are processed.
  Values: `immediate`, `urgent`, `high`, `normal`, `low`, `languid`
- `wait_for_nodes` (number | string)
  Wait until the specified number (N) of nodes is available.
It also accepts `>=N`, `<=N`, `>N` and `<N`.
Alternatively, use the notations `ge(N)`, `le(N)`, `gt(N)`, and `lt(N)`.
- `wait_for_no_initializing_shards` (boolean · default: false)
  Wait (until the timeout expires) for the cluster to have no shard initializations.
If false, the request does not wait for initializing shards.
- `wait_for_no_relocating_shards` (boolean · default: false)
  Wait (until the timeout expires) for the cluster to have no shard relocations.
If false, the request not wait for relocating shards.
- `wait_for_status` (enum HealthStatus)
  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.

Supported values include:
  - `green` (or `GREEN`): All shards are assigned.
  - `yellow` (or `YELLOW`): All primary shards are assigned, but one or more replica shards are unassigned. If a node in the cluster fails, some data could be unavailable until that node is repaired.
  - `red` (or `RED`): One or more primary shards are unassigned, so some data is unavailable. This can occur briefly during cluster startup as primary shards are assigned.
  - `unknown`
  - `unavailable`
  Values: `green`, `GREEN`, `yellow`, `YELLOW`, `red`, `RED`, `unknown`, `unavailable`

## Response

`application/json`

- `active_primary_shards` (number)
  The number of active primary shards.
- `active_shards` (number)
  The total number of active primary and replica shards.
- `active_shards_percent` (string)
  The ratio of active shards in the cluster expressed as a string formatted percentage.
- `active_shards_percent_as_number` (number)
  The ratio of active shards in the cluster expressed as a percentage.
- `cluster_name` (string Name)
  The name of the cluster.
- `delayed_unassigned_shards` (number)
  The number of shards whose allocation has been delayed by the timeout settings.
- `indices` (map string to IndexHealthStats)
  Map values ({} IndexHealthStats)
  - `active_primary_shards` (number)
  - `active_shards` (number)
  - `initializing_shards` (number)
  - `number_of_replicas` (number)
  - `number_of_shards` (number)
  - `relocating_shards` (number)
  - `shards` (map string to ShardHealthStats)
    Map values ({} ShardHealthStats)
    - `active_shards` (number)
    - `initializing_shards` (number)
    - `primary_active` (boolean)
    - `relocating_shards` (number)
    - `status` (enum HealthStatus)
      

Supported values include:
  - `green` (or `GREEN`): All shards are assigned.
  - `yellow` (or `YELLOW`): All primary shards are assigned, but one or more replica shards are unassigned. If a node in the cluster fails, some data could be unavailable until that node is repaired.
  - `red` (or `RED`): One or more primary shards are unassigned, so some data is unavailable. This can occur briefly during cluster startup as primary shards are assigned.
  - `unknown`
  - `unavailable`
      Values: `green`, `GREEN`, `yellow`, `YELLOW`, `red`, `RED`, `unknown`, `unavailable`
    - `unassigned_shards` (number)
    - `unassigned_primary_shards` (number)
  - `status` (enum HealthStatus)
    

Supported values include:
  - `green` (or `GREEN`): All shards are assigned.
  - `yellow` (or `YELLOW`): All primary shards are assigned, but one or more replica shards are unassigned. If a node in the cluster fails, some data could be unavailable until that node is repaired.
  - `red` (or `RED`): One or more primary shards are unassigned, so some data is unavailable. This can occur briefly during cluster startup as primary shards are assigned.
  - `unknown`
  - `unavailable`
    Values: `green`, `GREEN`, `yellow`, `YELLOW`, `red`, `RED`, `unknown`, `unavailable`
  - `unassigned_shards` (number)
  - `unassigned_primary_shards` (number)
- `initializing_shards` (number)
  The number of shards that are under initialization.
- `number_of_data_nodes` (number)
  The number of nodes that are dedicated data nodes.
- `number_of_in_flight_fetch` (number)
  The number of unfinished fetches.
- `number_of_nodes` (number)
  The number of nodes within the cluster.
- `number_of_pending_tasks` (number)
  The number of cluster-level changes that have not yet been executed.
- `relocating_shards` (number)
  The number of shards that are under relocation.
- `status` (enum HealthStatus)
  

Supported values include:
  - `green` (or `GREEN`): All shards are assigned.
  - `yellow` (or `YELLOW`): All primary shards are assigned, but one or more replica shards are unassigned. If a node in the cluster fails, some data could be unavailable until that node is repaired.
  - `red` (or `RED`): One or more primary shards are unassigned, so some data is unavailable. This can occur briefly during cluster startup as primary shards are assigned.
  - `unknown`
  - `unavailable`
  Values: `green`, `GREEN`, `yellow`, `YELLOW`, `red`, `RED`, `unknown`, `unavailable`
- `task_max_waiting_in_queue` (string Duration)
  The time since the earliest initiated task is waiting for being performed.
- `task_max_waiting_in_queue_millis` (DurationValueUnitMillis)
  The time expressed in milliseconds since the earliest initiated task is waiting for being performed.
- `timed_out` (boolean)
  If false the response returned within the period of time that is specified by the timeout parameter (30s by default)
- `unassigned_primary_shards` (number)
  The number of primary shards that are not allocated.
- `unassigned_shards` (number)
  The number of shards that are not allocated.
## Code Examples

#### Console

```console
GET _cluster/health
```

#### JavaScript

```javascript
const response = await client.cluster.health();
```

#### Python

```python
resp = client.cluster.health()
```

#### curl

```curl
curl -X GET "$ELASTICSEARCH_URL/_cluster/health" \
  -H "Authorization: ApiKey $ELASTIC_API_KEY"
```

#### Java

```java
client.cluster().health(h -> h);
```

#### C#

```c#
var response = await client.Cluster.HealthAsync();
```

#### PHP

```php
$resp = $client->cluster()->health();
```

#### Ruby

```ruby
response = client.cluster.health
```

## Response Examples

#### Cluster health response example1

A successful response from `GET _cluster/health`. It is the health status of a quiet single node cluster with a single index with one shard and one replica.

```json
{
  "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
}
```

