java.lang.Object
org.elasticsearch.action.search.SearchShardIterator
- All Implemented Interfaces:
Comparable<SearchShardIterator>
Iterator for shards used in the search api, which also holds the
OriginalIndices
of the search request (useful especially with cross-cluster search, as each cluster has its own set of original indices) as well as
the cluster alias.- See Also:
-
Constructor Summary
ConstructorsConstructorDescriptionSearchShardIterator(String clusterAlias, ShardId shardId, List<String> targetNodeIds, OriginalIndices originalIndices, ShardSearchContextId searchContextId, TimeValue searchContextKeepAlive, boolean prefiltered, boolean skip) Creates aSearchShardIteratorinstance that iterates over a subset of the given shardsSearchShardIterator(String clusterAlias, ShardId shardId, List<ShardRouting> shards, OriginalIndices originalIndices) Creates aSearchShardIteratorinstance that iterates over a subset of the given shards this the a givenshardId. -
Method Summary
-
Constructor Details
-
SearchShardIterator
public SearchShardIterator(@Nullable String clusterAlias, ShardId shardId, List<ShardRouting> shards, OriginalIndices originalIndices) Creates aSearchShardIteratorinstance that iterates over a subset of the given shards this the a givenshardId.- Parameters:
clusterAlias- the alias of the cluster where the shard is locatedshardId- shard id of the groupshards- shards to iterateoriginalIndices- the indices that the search request originally related to (before any rewriting happened)
-
SearchShardIterator
public SearchShardIterator(@Nullable String clusterAlias, ShardId shardId, List<String> targetNodeIds, OriginalIndices originalIndices, ShardSearchContextId searchContextId, TimeValue searchContextKeepAlive, boolean prefiltered, boolean skip) Creates aSearchShardIteratorinstance that iterates over a subset of the given shards- Parameters:
clusterAlias- the alias of the cluster where the shard is locatedshardId- shard id of the grouptargetNodeIds- the list of nodes hosting shard copiesoriginalIndices- the indices that the search request originally related to (before any rewriting happened)searchContextId- the point-in-time specified for this group if existssearchContextKeepAlive- the time interval that data nodes should extend the keep alive of the point-in-timeprefiltered- if true, then this group already executed the can_match phaseskip- if true, then this group won't have matches, and it can be safely skipped from the search
-
-
Method Details
-
getOriginalIndices
Returns the original indices associated with this shard iterator, specifically with the cluster that this shard belongs to. -
getClusterAlias
Returns the alias of the cluster where the shard is located. -
size
public int size()The number of shard routing instances.- Returns:
- number of shard routing instances in this iterator
-
equals
-
hashCode
public int hashCode() -
compareTo
- Specified by:
compareToin interfaceComparable<SearchShardIterator>
-