Class RoutingTable
org.elasticsearch.cluster.routing.RoutingTable
- All Implemented Interfaces:
<IndexRoutingTable>
,Diffable<RoutingTable>
,Writeable
Represents a global cluster-wide routing table for all indices including the
version of the current routing state.
- See Also:
IndexRoutingTable
-
Nested Class Summary
Modifier and TypeClassDescriptionstatic class
Builder for the routing table.Nested classes/interfaces inherited from interface org.elasticsearch.common.io.stream.Writeable
Writeable.Reader<V>, Writeable.Writer<V>
-
Field Summary
-
Method Summary
Modifier and TypeMethodDescription[] indices, boolean includeEmpty)
All the *active* primary shards for the provided indices grouped (each group is a single element, consisting of the primary shard).[] indices, boolean includeEmpty)
Return GroupShardsIterator where each active shard routing has it's own shard iterator.[] 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.index)
All the shards (replicas) for the provided index.[] indices)
[] indices)
static RoutingTable.Builder
builder()
static RoutingTable.Builder
builder(RoutingTable routingTable)
diff(RoutingTable previousState)
Returns serializable object representing differences between this and previousStategetByAllocationId(ShardId shardId, allocationId)
boolean
index)
boolean
index)
iterator()
static Diff<RoutingTable>
readDiffFrom(StreamInput in)
static RoutingTable
readFrom(StreamInput in)
index, int shardId)
All shards for the provided index and shard idstatic IndexShardRoutingTable
shardRoutingTable(IndexRoutingTable indexRouting, int shardId)
Get's theIndexShardRoutingTable
for the given shard id from the givenIndexRoutingTable
or throws aShardNotFoundException
if no shard by the given id is found in the IndexRoutingTable.shardRoutingTable(ShardId shardId)
All shards for the providedShardId
shardsWithState(ShardRoutingState state)
toString()
boolean
long
version()
Returns the version of theRoutingTable
.void
writeTo(StreamOutput out)
Write this into the StreamOutput.Methods inherited from class java.lang.
, , , , , , , , ,
Methods inherited from interface java.lang.
,
-
Field Details
-
EMPTY_ROUTING_TABLE
-
-
Method Details
-
shardRoutingTable
public static IndexShardRoutingTable shardRoutingTable(IndexRoutingTable indexRouting, int shardId)Get's theIndexShardRoutingTable
for the given shard id from the givenIndexRoutingTable
or throws aShardNotFoundException
if no shard by the given id is found in the IndexRoutingTable.- Parameters:
indexRouting
- IndexRoutingTableshardId
- ShardId- Returns:
- IndexShardRoutingTable
-
version
public long version()Returns the version of theRoutingTable
.- Returns:
- version of the
RoutingTable
-
iterator
- Specified by:
in interface
<IndexRoutingTable>
-
hasIndex
public boolean hasIndex( index) -
hasIndex
-
index
public index) -
index
-
indicesRouting
-
getIndicesRouting
-
shardRoutingTable
public index, int shardId)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
-
shardsWithState
-
allShards
All the shards (replicas) for all indices in this routing table.- Returns:
- All the shards
-
allShards
public < index)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 [] 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 [] 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
public [] indices) -
allShardsIncludingRelocationTargets
public [] indices) -
activePrimaryShardsGrouped
public [] 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:Diffable
Returns serializable object representing differences between this and previousState- Specified by:
diff
in interfaceDiffable<RoutingTable>
-
readDiffFrom
- Throws:
-
readFrom
- Throws:
-
writeTo
Description copied from interface:Writeable
Write this into the StreamOutput. -
builder
-
builder
-
toString
public toString()- Overrides:
in class
-