Class HealthRequest

java.lang.Object
co.elastic.clients.elasticsearch._types.RequestBase
co.elastic.clients.elasticsearch.cluster.HealthRequest

public class HealthRequest extends RequestBase
Get the cluster health status.

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.

See Also:
  • Field Details

  • Method Details

    • of

    • expandWildcards

      public final List<ExpandWildcard> expandWildcards()
      Expand wildcard expression to concrete indices that are open, closed or both.

      API name: expand_wildcards

    • index

      public final List<String> index()
      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 *.

      API name: index

    • level

      @Nullable public final Level level()
      Return health information at a specific level of detail.

      API name: level

    • local

      @Nullable public final Boolean local()
      If true, retrieve information from the local node only. If false, retrieve information from the master node.

      API name: local

    • masterTimeout

      @Nullable public final Time masterTimeout()
      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.

      API name: master_timeout

    • timeout

      @Nullable public final Time timeout()
      The period to wait for a response. If no response is received before the timeout expires, the request fails and returns an error.

      API name: timeout

    • waitForActiveShards

      @Nullable public final WaitForActiveShards waitForActiveShards()
      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.

      API name: wait_for_active_shards

    • waitForEvents

      @Nullable public final WaitForEvents waitForEvents()
      Wait until all currently queued events with the given priority are processed.

      API name: wait_for_events

    • waitForNoInitializingShards

      @Nullable public final Boolean waitForNoInitializingShards()
      Wait (until the timeout expires) for the cluster to have no shard initializations. If false, the request does not wait for initializing shards.

      API name: wait_for_no_initializing_shards

    • waitForNoRelocatingShards

      @Nullable public final Boolean waitForNoRelocatingShards()
      Wait (until the timeout expires) for the cluster to have no shard relocations. If false, the request not wait for relocating shards.

      API name: wait_for_no_relocating_shards

    • waitForNodes

      @Nullable public final String waitForNodes()
      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).

      API name: wait_for_nodes

    • waitForStatus

      @Nullable public final HealthStatus waitForStatus()
      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.

      API name: wait_for_status

    • rebuild

      public HealthRequest.Builder rebuild()
      Returns:
      New HealthRequest.Builder initialized with field values of this instance