Class ClusterInfo

java.lang.Object
org.elasticsearch.cluster.ClusterInfo
All Implemented Interfaces:
Writeable, org.elasticsearch.common.xcontent.ToXContent, org.elasticsearch.common.xcontent.ToXContentFragment

public class ClusterInfo extends Object implements org.elasticsearch.common.xcontent.ToXContentFragment, Writeable
ClusterInfo is an object representing a map of nodes to DiskUsage and a map of shard ids to shard sizes, see InternalClusterInfoService.shardIdentifierFromRouting(String) for the key used in the shardSizes map
  • Field Details

    • DATA_SET_SIZE_SIZE_VERSION

      public static final Version DATA_SET_SIZE_SIZE_VERSION
    • EMPTY

      public static final ClusterInfo EMPTY
  • 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
    • 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
    • getNodeLeastAvailableDiskUsages

      public ImmutableOpenMap<String,​DiskUsage> getNodeLeastAvailableDiskUsages()
      Returns a node id to disk usage mapping for the path that has the least available space on the node. Note that this does not take account of reserved space: there may be another path with less available _and unreserved_ space.
    • getNodeMostAvailableDiskUsages

      public ImmutableOpenMap<String,​DiskUsage> getNodeMostAvailableDiskUsages()
      Returns a node id to disk usage mapping for the path that has the most available space on the node. Note that this does not take account of reserved space: there may be another path with more available _and unreserved_ space.
    • getShardSize

      public Long getShardSize(ShardRouting shardRouting)
      Returns the shard size for the given shard routing or null it that metric is not available.
    • getDataPath

      public String getDataPath(ShardRouting shardRouting)
      Returns the nodes absolute data-path the given shard is allocated on or null if the information is not available.
    • getShardSize

      public long getShardSize(ShardRouting shardRouting, long defaultValue)
      Returns the shard size for the given shard routing or defaultValue it that metric is not available.
    • getShardDataSetSize

      public Optional<Long> getShardDataSetSize(ShardId shardId)
    • getReservedSpace

      public ClusterInfo.ReservedSpace getReservedSpace(String nodeId, String dataPath)
      Returns the reserved space for each shard on the given node/path pair
    • shardIdentifierFromRouting

      public static String shardIdentifierFromRouting(ShardRouting shardRouting)
      Method that incorporates the ShardId for the shard into a string that includes a 'p' or 'r' depending on whether the shard is a primary.