Class IndexRoutingTable

  • All Implemented Interfaces:
    java.lang.Iterable<IndexShardRoutingTable>, Diffable<IndexRoutingTable>, Writeable

    public class IndexRoutingTable
    extends AbstractDiffable<IndexRoutingTable>
    implements java.lang.Iterable<IndexShardRoutingTable>
    The IndexRoutingTable represents routing information for a single index. The routing table maintains a list of all shards in the index. A single shard in this context has one more instances namely exactly one primary and 1 or more replicas. In other words, each instance of a shard is considered a replica while only one replica per shard is a primary replica. The primary replica can be seen as the "leader" of the shard acting as the primary entry point for operations on a specific shard.

    Note: The term replica is not directly reflected in the routing table or in related classes, replicas are represented as ShardRouting.

    • Method Detail

      • getIndex

        public Index getIndex()
        Return the index id
        id of the index
      • numberOfNodesShardsAreAllocatedOn

        public int numberOfNodesShardsAreAllocatedOn​(java.lang.String... excludedNodes)
        Calculates the number of nodes that hold one or more shards of this index IndexRoutingTable excluding the nodes with the node ids give as the excludedNodes parameter.
        excludedNodes - id of nodes that will be excluded
        number of distinct nodes this index has at least one shard allocated on
      • allPrimaryShardsActive

        public boolean allPrimaryShardsActive()
        Returns true if all shards are primary and active. Otherwise false.
      • primaryShardsActive

        public int primaryShardsActive()
        Calculates the number of primary shards in active state in routing table
        number of active primary shards
      • allPrimaryShardsUnassigned

        public boolean allPrimaryShardsUnassigned()
        Returns true if all primary shards are in ShardRoutingState.UNASSIGNED state. Otherwise false.
      • primaryShardsUnassigned

        public int primaryShardsUnassigned()
        Calculates the number of primary shards in the routing table the are in ShardRoutingState.UNASSIGNED state.
      • randomAllActiveShardsIt

        public ShardsIterator randomAllActiveShardsIt()
        Returns an unordered iterator over all active shards (including replicas).
      • equals

        public boolean equals​(java.lang.Object o)
        equals in class java.lang.Object
      • hashCode

        public int hashCode()
        hashCode in class java.lang.Object
      • prettyPrint

        public java.lang.String prettyPrint()