java.lang.Object
org.elasticsearch.cluster.routing.RoutingTable
- All Implemented Interfaces:
Iterable<IndexRoutingTable>,Diffable<RoutingTable>,Writeable
public class RoutingTable
extends Object
implements Iterable<IndexRoutingTable>, Diffable<RoutingTable>
Represents a global cluster-wide routing table for all indices including the
version of the current routing state.
- See Also:
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic classBuilder for the routing table.Nested classes/interfaces inherited from interface org.elasticsearch.common.io.stream.Writeable
Writeable.Reader<V>, Writeable.Writer<V> -
Field Summary
Fields -
Method Summary
Modifier and TypeMethodDescriptionactivePrimaryShardsGrouped(String[] indices, boolean includeEmpty) All the *active* primary shards for the provided indices grouped (each group is a single element, consisting of the primary shard).allActiveShards(String[] indices) allActiveShardsGrouped(String[] indices, boolean includeEmpty) Return GroupShardsIterator where each active shard routing has it's own shard iterator.allAssignedShardsGrouped(String[] indices, boolean includeEmpty) Return GroupShardsIterator where each assigned shard routing has it's own shard iterator.All the shards (replicas) for all indices in this routing table.All the shards (replicas) for the provided index.allShardsIncludingRelocationTargets(String[] indices) static RoutingTable.Builderbuilder()static RoutingTable.Builderbuilder(RoutingTable routingTable) static RoutingTable.Builderbuilder(ShardRoutingRoleStrategy shardRoutingRoleStrategy) static RoutingTable.Builderbuilder(ShardRoutingRoleStrategy shardRoutingRoleStrategy, RoutingTable routingTable) diff(RoutingTable previousState) Returns serializable object representing differences between this and previousStategetByAllocationId(ShardId shardId, String allocationId) booleanbooleaniterator()static RoutingTableof(RoutingNodes routingNodes) static Diff<RoutingTable> static RoutingTablereadFrom(StreamInput in) shardRoutingTable(String index, int shardId) All shards for the provided index and shard idstatic IndexShardRoutingTableshardRoutingTable(IndexRoutingTable indexRouting, int shardId) Get's theIndexShardRoutingTablefor the given shard id from the givenIndexRoutingTableor throws aShardNotFoundExceptionif no shard by the given id is found in the IndexRoutingTable.shardRoutingTable(ShardId shardId) All shards for the providedShardIdtoString()booleanvoidwriteTo(StreamOutput out) Write this into the StreamOutput.Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, waitMethods inherited from interface java.lang.Iterable
forEach, spliterator
-
Field Details
-
EMPTY_ROUTING_TABLE
-
-
Method Details
-
shardRoutingTable
Get's theIndexShardRoutingTablefor the given shard id from the givenIndexRoutingTableor throws aShardNotFoundExceptionif no shard by the given id is found in the IndexRoutingTable.- Parameters:
indexRouting- IndexRoutingTableshardId- ShardId- Returns:
- IndexShardRoutingTable
-
iterator
- Specified by:
iteratorin interfaceIterable<IndexRoutingTable>
-
hasIndex
-
hasIndex
-
index
-
index
-
indicesRouting
-
getIndicesRouting
-
shardRoutingTable
All shards for the provided index and shard id- Returns:
- All the shard routing entries for the given index and shard id
- Throws:
IndexNotFoundException- if provided index does not existShardNotFoundException- if provided shard id is unknown
-
shardRoutingTable
All shards for the providedShardId- Returns:
- All the shard routing entries for the given index and shard id
- Throws:
IndexNotFoundException- if provided index does not existShardNotFoundException- if provided shard id is unknown
-
getByAllocationId
-
validate
-
allShards
All the shards (replicas) for all indices in this routing table.- Returns:
- All the shards
-
allShardsIterator
-
allShards
All the shards (replicas) for the provided index.- Parameters:
index- The index to return all the shards (replicas).- Returns:
- All the shards matching the specific index
- Throws:
IndexNotFoundException- If the index passed does not exists
-
allActiveShardsGrouped
public GroupShardsIterator<ShardIterator> allActiveShardsGrouped(String[] indices, boolean includeEmpty) Return GroupShardsIterator where each active shard routing has it's own shard iterator.- Parameters:
includeEmpty- if true, a shard iterator will be added for non-assigned shards as well
-
allAssignedShardsGrouped
public GroupShardsIterator<ShardIterator> allAssignedShardsGrouped(String[] indices, boolean includeEmpty) Return GroupShardsIterator where each assigned shard routing has it's own shard iterator.- Parameters:
includeEmpty- if true, a shard iterator will be added for non-assigned shards as well
-
allShards
-
allActiveShards
-
allShardsIncludingRelocationTargets
-
activePrimaryShardsGrouped
public GroupShardsIterator<ShardIterator> activePrimaryShardsGrouped(String[] indices, boolean includeEmpty) All the *active* primary shards for the provided indices grouped (each group is a single element, consisting of the primary shard). This is handy for components that expect to get group iterators, but still want in some cases to iterate over all primary shards (and not just one shard in replication group).- Parameters:
indices- The indices to return all the shards (replicas)- Returns:
- All the primary shards grouped into a single shard element group each
- Throws:
IndexNotFoundException- If an index passed does not exists
-
diff
Description copied from interface:DiffableReturns serializable object representing differences between this and previousState- Specified by:
diffin interfaceDiffable<RoutingTable>
-
readDiffFrom
- Throws:
IOException
-
readFrom
- Throws:
IOException
-
writeTo
Description copied from interface:WriteableWrite this into the StreamOutput.- Specified by:
writeToin interfaceWriteable- Throws:
IOException
-
of
-
builder
-
builder
-
builder
-
builder
public static RoutingTable.Builder builder(ShardRoutingRoleStrategy shardRoutingRoleStrategy, RoutingTable routingTable) -
toString
-