Package org.elasticsearch.cluster.health
Class ClusterShardHealth
- java.lang.Object
-
- org.elasticsearch.cluster.health.ClusterShardHealth
-
- All Implemented Interfaces:
Writeable
,ToXContent
,ToXContentFragment
public final class ClusterShardHealth extends java.lang.Object implements Writeable, ToXContentFragment
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from interface org.elasticsearch.common.xcontent.ToXContent
ToXContent.DelegatingMapParams, ToXContent.MapParams, ToXContent.Params
-
Nested classes/interfaces inherited from interface org.elasticsearch.common.io.stream.Writeable
Writeable.Reader<V>, Writeable.Writer<V>
-
-
Field Summary
Fields Modifier and Type Field Description static ConstructingObjectParser<ClusterShardHealth,java.lang.Integer>
PARSER
-
Fields inherited from interface org.elasticsearch.common.xcontent.ToXContent
EMPTY_PARAMS
-
-
Constructor Summary
Constructors Constructor Description ClusterShardHealth(int shardId, IndexShardRoutingTable shardRoutingTable)
ClusterShardHealth(StreamInput in)
-
Method Summary
Modifier and Type Method Description boolean
equals(java.lang.Object o)
static ClusterShardHealth
fromXContent(XContentParser parser)
int
getActiveShards()
static ClusterHealthStatus
getInactivePrimaryHealth(ShardRouting shardRouting)
Checks if an inactive primary shard should cause the cluster health to go RED.int
getInitializingShards()
int
getRelocatingShards()
int
getShardId()
ClusterHealthStatus
getStatus()
int
getUnassignedShards()
int
hashCode()
boolean
isPrimaryActive()
java.lang.String
toString()
XContentBuilder
toXContent(XContentBuilder builder, ToXContent.Params params)
void
writeTo(StreamOutput out)
Write this into the StreamOutput.-
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
-
Methods inherited from interface org.elasticsearch.common.xcontent.ToXContentFragment
isFragment
-
-
-
-
Field Detail
-
PARSER
public static final ConstructingObjectParser<ClusterShardHealth,java.lang.Integer> PARSER
-
-
Constructor Detail
-
ClusterShardHealth
public ClusterShardHealth(int shardId, IndexShardRoutingTable shardRoutingTable)
-
ClusterShardHealth
public ClusterShardHealth(StreamInput in) throws java.io.IOException
- Throws:
java.io.IOException
-
-
Method Detail
-
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 java.io.IOException
Description copied from interface:Writeable
Write this into the StreamOutput.
-
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 java.io.IOException
- Specified by:
toXContent
in interfaceToXContent
- Throws:
java.io.IOException
-
fromXContent
public static ClusterShardHealth fromXContent(XContentParser parser) throws java.io.IOException
- Throws:
java.io.IOException
-
toString
public java.lang.String toString()
- Overrides:
toString
in classjava.lang.Object
-
equals
public boolean equals(java.lang.Object o)
- Overrides:
equals
in classjava.lang.Object
-
hashCode
public int hashCode()
- Overrides:
hashCode
in classjava.lang.Object
-
-