Class ClusterShardHealth

java.lang.Object
org.elasticsearch.cluster.health.ClusterShardHealth
All Implemented Interfaces:
Writeable, ToXContent, ToXContentFragment

public final class ClusterShardHealth extends Object implements Writeable, ToXContentFragment
  • Field Details

  • Constructor Details

  • Method Details

    • getShardId

      public int getShardId()
    • getStatus

      public ClusterHealthStatus getStatus()
    • getRelocatingShards

      public int getRelocatingShards()
    • getActiveShards

      public int getActiveShards()
    • isPrimaryActive

      public boolean isPrimaryActive()
    • getInitializingShards

      public int getInitializingShards()
    • getUnassignedShards

      public int getUnassignedShards()
    • 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
    • getInactivePrimaryHealth

      public static ClusterHealthStatus getInactivePrimaryHealth(ShardRouting shardRouting)
      Checks if an inactive primary shard should cause the cluster health to go RED. An inactive primary shard in an index should cause the cluster health to be RED to make it visible that some of the existing data is unavailable. In case of index creation, snapshot restore or index shrinking, which are unexceptional events in the cluster lifecycle, cluster health should not turn RED for the time where primaries are still in the initializing state but go to YELLOW instead. However, in case of exceptional events, for example when the primary shard cannot be assigned to a node or initialization fails at some point, cluster health should still turn RED. NB: this method should *not* be called on active shards nor on non-primary shards.
    • toXContent

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

      public static ClusterShardHealth fromXContent(XContentParser parser) throws IOException
      Throws:
      IOException
    • toString

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

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

      public int hashCode()
      Overrides:
      hashCode in class Object