Class PrimaryShardAllocator

java.lang.Object
org.elasticsearch.gateway.BaseGatewayShardAllocator
org.elasticsearch.gateway.PrimaryShardAllocator

public abstract class PrimaryShardAllocator extends BaseGatewayShardAllocator
The primary shard allocator allocates unassigned primary shards to nodes that hold valid copies of the unassigned primaries. It does this by iterating over all unassigned primary shards in the routing table and fetching shard metadata from each node in the cluster that holds a copy of the shard. The shard metadata from each node is compared against the set of valid allocation IDs and for all valid shard copies (if any), the primary shard allocator executes the allocation deciders to chose a copy to assign the primary shard to. Note that the PrimaryShardAllocator does *not* allocate primaries on index creation (see BalancedShardsAllocator), nor does it allocate primaries when a primary shard failed and there is a valid replica copy that can immediately be promoted to primary, as this takes place in RoutingNodes.failShard(org.apache.logging.log4j.Logger, org.elasticsearch.cluster.routing.ShardRouting, org.elasticsearch.cluster.routing.UnassignedInfo, org.elasticsearch.cluster.metadata.IndexMetadata, org.elasticsearch.cluster.routing.RoutingChangesObserver).