Class NodeAllocationResult

java.lang.Object
org.elasticsearch.cluster.routing.allocation.NodeAllocationResult
All Implemented Interfaces:
Comparable<NodeAllocationResult>, Writeable, org.elasticsearch.common.xcontent.ToXContent, org.elasticsearch.common.xcontent.ToXContentObject

public class NodeAllocationResult extends Object implements org.elasticsearch.common.xcontent.ToXContentObject, Writeable, Comparable<NodeAllocationResult>
This class represents the shard allocation decision and its explanation for a single node.
  • Constructor Details

  • Method Details

    • 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
    • getNode

      public DiscoveryNode getNode()
      Get the node that this decision is for.
    • getShardStoreInfo

      @Nullable public NodeAllocationResult.ShardStoreInfo getShardStoreInfo()
      Get the shard store information for the node, if it exists.
    • getCanAllocateDecision

      @Nullable public Decision getCanAllocateDecision()
      The decision details for allocating to this node. Returns null if no allocation decision was taken on the node; in this case, getNodeDecision() will return AllocationDecision.NO.
    • isWeightRanked

      public boolean isWeightRanked()
      Is the weight assigned for the node?
    • getWeightRanking

      public int getWeightRanking()
      The weight ranking for allocating a shard to the node. Each node will have a unique weight ranking that is relative to the other nodes against which the deciders ran. For example, suppose there are 3 nodes which the allocation deciders decided upon: node1, node2, and node3. If node2 had the best weight for holding the shard, followed by node3, followed by node1, then node2's weight will be 1, node3's weight will be 2, and node1's weight will be 1. A value of 0 means the weight was not calculated or factored into the decision.
    • getNodeDecision

      public AllocationDecision getNodeDecision()
      Gets the AllocationDecision for allocating to this node.
    • 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
    • compareTo

      public int compareTo(NodeAllocationResult other)
      Specified by:
      compareTo in interface Comparable<NodeAllocationResult>