Module org.elasticsearch.server
Class ClusterAllocationExplanation
java.lang.Object
org.elasticsearch.action.admin.cluster.allocation.ClusterAllocationExplanation
- All Implemented Interfaces:
Writeable
,ChunkedToXContent
,ChunkedToXContentObject
public final class ClusterAllocationExplanation
extends Object
implements ChunkedToXContentObject, Writeable
A
ClusterAllocationExplanation
is an explanation of why a shard is unassigned,
or if it is not unassigned, then which nodes it could possibly be relocated to.
It is an immutable class.-
Nested Class Summary
Nested classes/interfaces inherited from interface org.elasticsearch.common.io.stream.Writeable
Writeable.Reader<V>, Writeable.Writer<V>
-
Field Summary
Fields inherited from interface org.elasticsearch.common.xcontent.ChunkedToXContent
EMPTY
-
Constructor Summary
ConstructorsConstructorDescriptionClusterAllocationExplanation
(boolean specificShard, ShardRouting shardRouting, DiscoveryNode currentNode, DiscoveryNode relocationTargetNode, ClusterInfo clusterInfo, ShardAllocationDecision shardAllocationDecision) -
Method Summary
Modifier and TypeMethodDescriptionReturns the cluster disk info for the cluster, ornull
if none available.Returns the currently assigned node, ornull
if the shard is unassigned.Returns the relocating target node, ornull
if the shard is not in theShardRoutingState.RELOCATING
state.getShard()
Returns the shard that the explanation is about.Returns the shard allocation decision for attempting to assign or move the shard.Returns the currentShardRoutingState
of the shard.Returns the unassigned info for the shard, ornull
if the shard is active.boolean
Returnstrue
if the explained shard is primary,false
otherwise.boolean
Iterator<? extends ToXContent>
toXContentChunked
(ToXContent.Params params) Create an iterator ofToXContent
chunks for a REST response.void
writeTo
(StreamOutput out) Write this into the StreamOutput.Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
Methods inherited from interface org.elasticsearch.common.xcontent.ChunkedToXContent
toXContentChunkedV7
Methods inherited from interface org.elasticsearch.common.xcontent.ChunkedToXContentObject
isFragment
-
Constructor Details
-
ClusterAllocationExplanation
public ClusterAllocationExplanation(boolean specificShard, ShardRouting shardRouting, @Nullable DiscoveryNode currentNode, @Nullable DiscoveryNode relocationTargetNode, @Nullable ClusterInfo clusterInfo, ShardAllocationDecision shardAllocationDecision) -
ClusterAllocationExplanation
- Throws:
IOException
-
-
Method Details
-
writeTo
Description copied from interface:Writeable
Write this into the StreamOutput.- Specified by:
writeTo
in interfaceWriteable
- Throws:
IOException
-
isSpecificShard
public boolean isSpecificShard() -
getShard
Returns the shard that the explanation is about. -
isPrimary
public boolean isPrimary()Returnstrue
if the explained shard is primary,false
otherwise. -
getShardState
Returns the currentShardRoutingState
of the shard. -
getCurrentNode
Returns the currently assigned node, ornull
if the shard is unassigned. -
getRelocationTargetNode
Returns the relocating target node, ornull
if the shard is not in theShardRoutingState.RELOCATING
state. -
getUnassignedInfo
Returns the unassigned info for the shard, ornull
if the shard is active. -
getClusterInfo
Returns the cluster disk info for the cluster, ornull
if none available. -
getShardAllocationDecision
Returns the shard allocation decision for attempting to assign or move the shard. -
toXContentChunked
Description copied from interface:ChunkedToXContent
Create an iterator ofToXContent
chunks for a REST response. Each chunk is serialized with the sameXContentBuilder
andToXContent.Params
, which is also the same as theToXContent.Params
passed as theparams
argument. For best results, all chunks should beO(1)
size. The last chunk in the iterator must always yield at least one byte of output. See alsoChunkedToXContentHelper
for some handy utilities.Note that chunked response bodies cannot send deprecation warning headers once transmission has started, so implementations must check for deprecated feature use before returning.
- Specified by:
toXContentChunked
in interfaceChunkedToXContent
- Returns:
- iterator over chunks of
ToXContent
-