public class IndexShardRoutingTable extends java.lang.Object implements java.lang.Iterable<ShardRouting>
IndexShardRoutingTable
encapsulates all instances of a single shard.
Each Elasticsearch index consists of multiple shards, each shard encapsulates
a disjoint set of the index data and each shard has one or more instances
referred to as replicas of a shard. Given that, this class encapsulates all
replicas (instances) for a single index shard.Modifier and Type | Class and Description |
---|---|
static class |
IndexShardRoutingTable.Builder |
Modifier and Type | Method and Description |
---|---|
ShardIterator |
activeInitializingShardsIt(int seed)
Returns an iterator over active and initializing shards.
|
ShardIterator |
activeInitializingShardsRandomIt()
Returns an iterator over active and initializing shards.
|
java.util.List<ShardRouting> |
activeShards()
Returns a
List of active shards |
boolean |
allShardsStarted()
Returns
true iff all shards in the routing table are started otherwise false |
java.util.List<ShardRouting> |
assignedShards()
Returns a
List of assigned shards |
boolean |
equals(java.lang.Object o) |
java.util.List<ShardRouting> |
getActiveShards()
Returns a
List of active shards |
java.util.List<ShardRouting> |
getAllInitializingShards()
Returns a
List of all initializing shards, including target shards of relocations |
java.util.List<ShardRouting> |
getAssignedShards()
Returns a
List of assigned shards |
ShardId |
getShardId()
Returns the shards id
|
java.util.List<ShardRouting> |
getShards()
Returns a
List of shards |
int |
getSize()
Returns the number of this shards instances.
|
int |
hashCode() |
java.util.Iterator<ShardRouting> |
iterator() |
ShardIterator |
onlyNodeActiveInitializingShardsIt(java.lang.String nodeId) |
ShardIterator |
onlyNodeSelectorActiveInitializingShardsIt(java.lang.String[] nodeAttributes,
DiscoveryNodes discoveryNodes)
Returns shards based on nodeAttributes given such as node name , node attribute, node IP
Supports node specifications in cluster API
|
ShardIterator |
onlyNodeSelectorActiveInitializingShardsIt(java.lang.String nodeAttributes,
DiscoveryNodes discoveryNodes) |
ShardIterator |
preferAttributesActiveInitializingShardsIt(java.lang.String[] attributes,
DiscoveryNodes nodes) |
ShardIterator |
preferAttributesActiveInitializingShardsIt(java.lang.String[] attributes,
DiscoveryNodes nodes,
int seed) |
ShardIterator |
preferNodeActiveInitializingShardsIt(java.util.Set<java.lang.String> nodeIds) |
ShardIterator |
primaryActiveInitializingShardIt() |
ShardIterator |
primaryFirstActiveInitializingShardsIt() |
ShardRouting |
primaryShard() |
ShardIterator |
primaryShardIt()
Returns an iterator only on the primary shard.
|
ShardIterator |
replicaActiveInitializingShardIt() |
ShardIterator |
replicaFirstActiveInitializingShardsIt() |
java.util.List<ShardRouting> |
replicaShards() |
java.util.List<ShardRouting> |
replicaShardsWithState(ShardRoutingState... states) |
ShardId |
shardId()
Returns the shards id
|
java.util.List<ShardRouting> |
shards()
Returns a
List of shards |
ShardIterator |
shardsIt() |
ShardIterator |
shardsIt(int seed) |
ShardIterator |
shardsRandomIt() |
java.util.List<ShardRouting> |
shardsWithState(ShardRoutingState state) |
int |
size()
Returns the number of this shards instances.
|
public ShardId shardId()
public ShardId getShardId()
public java.util.Iterator<ShardRouting> iterator()
iterator
in interface java.lang.Iterable<ShardRouting>
public int size()
public int getSize()
public java.util.List<ShardRouting> shards()
List
of shardsList
of shardspublic java.util.List<ShardRouting> getShards()
List
of shardsList
of shardspublic java.util.List<ShardRouting> activeShards()
List
of active shardsList
of shardspublic java.util.List<ShardRouting> getAllInitializingShards()
List
of all initializing shards, including target shards of relocationsList
of shardspublic java.util.List<ShardRouting> getActiveShards()
List
of active shardsList
of shardspublic java.util.List<ShardRouting> assignedShards()
List
of assigned shardsList
of shardspublic java.util.List<ShardRouting> getAssignedShards()
List
of assigned shardsList
of shardspublic ShardIterator shardsRandomIt()
public ShardIterator shardsIt()
public ShardIterator shardsIt(int seed)
public ShardIterator activeInitializingShardsRandomIt()
public ShardIterator activeInitializingShardsIt(int seed)
public ShardIterator primaryShardIt()
public ShardIterator primaryActiveInitializingShardIt()
public ShardIterator primaryFirstActiveInitializingShardsIt()
public ShardIterator replicaActiveInitializingShardIt()
public ShardIterator replicaFirstActiveInitializingShardsIt()
public ShardIterator onlyNodeActiveInitializingShardsIt(java.lang.String nodeId)
public ShardIterator onlyNodeSelectorActiveInitializingShardsIt(java.lang.String nodeAttributes, DiscoveryNodes discoveryNodes)
public ShardIterator onlyNodeSelectorActiveInitializingShardsIt(java.lang.String[] nodeAttributes, DiscoveryNodes discoveryNodes)
public ShardIterator preferNodeActiveInitializingShardsIt(java.util.Set<java.lang.String> nodeIds)
public boolean equals(java.lang.Object o)
equals
in class java.lang.Object
public int hashCode()
hashCode
in class java.lang.Object
public boolean allShardsStarted()
true
iff all shards in the routing table are started otherwise false
public ShardIterator preferAttributesActiveInitializingShardsIt(java.lang.String[] attributes, DiscoveryNodes nodes)
public ShardIterator preferAttributesActiveInitializingShardsIt(java.lang.String[] attributes, DiscoveryNodes nodes, int seed)
public ShardRouting primaryShard()
public java.util.List<ShardRouting> replicaShards()
public java.util.List<ShardRouting> replicaShardsWithState(ShardRoutingState... states)
public java.util.List<ShardRouting> shardsWithState(ShardRoutingState state)