Class ClusterHealthResponse

All Implemented Interfaces:
Writeable, StatusToXContentObject, org.elasticsearch.common.xcontent.ToXContent, org.elasticsearch.common.xcontent.ToXContentObject, org.elasticsearch.core.RefCounted

public class ClusterHealthResponse extends ActionResponse implements StatusToXContentObject
  • Constructor Details

    • ClusterHealthResponse

      public ClusterHealthResponse()
    • ClusterHealthResponse

      public ClusterHealthResponse(StreamInput in) throws IOException
      Throws:
      IOException
    • ClusterHealthResponse

      public ClusterHealthResponse(String clusterName, String[] concreteIndices, ClusterState clusterState)
      needed for plugins BWC
    • ClusterHealthResponse

      public ClusterHealthResponse(String clusterName, String[] concreteIndices, ClusterState clusterState, int numberOfPendingTasks, int numberOfInFlightFetch, int delayedUnassignedShards, org.elasticsearch.core.TimeValue taskMaxWaitingTime)
  • Method Details

    • getClusterName

      public String getClusterName()
    • getActiveShards

      public int getActiveShards()
    • getRelocatingShards

      public int getRelocatingShards()
    • getActivePrimaryShards

      public int getActivePrimaryShards()
    • getInitializingShards

      public int getInitializingShards()
    • getUnassignedShards

      public int getUnassignedShards()
    • getNumberOfNodes

      public int getNumberOfNodes()
    • getNumberOfDataNodes

      public int getNumberOfDataNodes()
    • getNumberOfPendingTasks

      public int getNumberOfPendingTasks()
    • getNumberOfInFlightFetch

      public int getNumberOfInFlightFetch()
    • getDelayedUnassignedShards

      public int getDelayedUnassignedShards()
      The number of unassigned shards that are currently being delayed (for example, due to node leaving the cluster and waiting for a timeout for the node to come back in order to allocate the shards back to it).
    • isTimedOut

      public boolean isTimedOut()
      true if the waitForXXX has timeout out and did not match.
    • setTimedOut

      public void setTimedOut(boolean timedOut)
    • getStatus

      public ClusterHealthStatus getStatus()
    • setStatus

      public void setStatus(ClusterHealthStatus status)
      Allows to explicitly override the derived cluster health status.
      Parameters:
      status - The override status. Must not be null.
    • getIndices

      public Map<String,ClusterIndexHealth> getIndices()
    • getTaskMaxWaitingTime

      public org.elasticsearch.core.TimeValue getTaskMaxWaitingTime()
      Returns:
      The maximum wait time of all tasks in the queue
    • getActiveShardsPercent

      public double getActiveShardsPercent()
      The percentage of active shards, should be 100% in a green system
    • readResponseFrom

      public static ClusterHealthResponse readResponseFrom(StreamInput in) throws IOException
      Throws:
      IOException
    • writeTo

      public void writeTo(StreamOutput out) throws IOException
      Description copied from interface: Writeable
      Write this into the StreamOutput.
      Specified by:
      writeTo in interface Writeable
      Throws:
      IOException
    • toString

      public String toString()
      Overrides:
      toString in class Object
    • status

      public RestStatus status()
      Description copied from interface: StatusToXContentObject
      Returns the REST status to make sure it is returned correctly
      Specified by:
      status in interface StatusToXContentObject
    • toXContent

      public org.elasticsearch.common.xcontent.XContentBuilder toXContent(org.elasticsearch.common.xcontent.XContentBuilder builder, org.elasticsearch.common.xcontent.ToXContent.Params params) throws IOException
      Specified by:
      toXContent in interface org.elasticsearch.common.xcontent.ToXContent
      Throws:
      IOException
    • fromXContent

      public static ClusterHealthResponse fromXContent(org.elasticsearch.common.xcontent.XContentParser parser)
    • equals

      public boolean equals(Object o)
      Overrides:
      equals in class Object
    • hashCode

      public int hashCode()
      Overrides:
      hashCode in class Object