Class SearchShardIterator

java.lang.Object
org.elasticsearch.action.search.SearchShardIterator
All Implemented Interfaces:
java.lang.Comparable<SearchShardIterator>, Countable

public final class SearchShardIterator
extends java.lang.Object
implements java.lang.Comparable<SearchShardIterator>, Countable
Extension of PlainShardIterator 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:
OriginalIndices
  • Constructor Summary

    Constructors
    Constructor Description
    SearchShardIterator​(java.lang.String clusterAlias, ShardId shardId, java.util.List<java.lang.String> targetNodeIds, OriginalIndices originalIndices, ShardSearchContextId searchContextId, org.elasticsearch.common.unit.TimeValue searchContextKeepAlive)  
    SearchShardIterator​(java.lang.String clusterAlias, ShardId shardId, java.util.List<ShardRouting> shards, OriginalIndices originalIndices)
    Creates a PlainShardIterator instance that iterates over a subset of the given shards this the a given shardId.
  • Method Summary

    Modifier and Type Method Description
    int compareTo​(SearchShardIterator o)  
    boolean equals​(java.lang.Object o)  
    java.lang.String getClusterAlias()
    Returns the alias of the cluster where the shard is located.
    OriginalIndices getOriginalIndices()
    Returns the original indices associated with this shard iterator, specifically with the cluster that this shard belongs to.
    int hashCode()  
    int size()  

    Methods inherited from class java.lang.Object

    clone, finalize, getClass, notify, notifyAll, toString, wait, wait, wait
  • Constructor Details

    • SearchShardIterator

      public SearchShardIterator​(@Nullable java.lang.String clusterAlias, ShardId shardId, java.util.List<ShardRouting> shards, OriginalIndices originalIndices)
      Creates a PlainShardIterator instance that iterates over a subset of the given shards this the a given shardId.
      Parameters:
      clusterAlias - the alias of the cluster where the shard is located
      shardId - shard id of the group
      shards - shards to iterate
      originalIndices - the indices that the search request originally related to (before any rewriting happened)
    • SearchShardIterator

      public SearchShardIterator​(@Nullable java.lang.String clusterAlias, ShardId shardId, java.util.List<java.lang.String> targetNodeIds, OriginalIndices originalIndices, ShardSearchContextId searchContextId, org.elasticsearch.common.unit.TimeValue searchContextKeepAlive)
  • Method Details

    • getOriginalIndices

      public OriginalIndices getOriginalIndices()
      Returns the original indices associated with this shard iterator, specifically with the cluster that this shard belongs to.
    • getClusterAlias

      @Nullable public java.lang.String getClusterAlias()
      Returns the alias of the cluster where the shard is located.
    • size

      public int size()
      Specified by:
      size in interface Countable
    • equals

      public boolean equals​(java.lang.Object o)
      Overrides:
      equals in class java.lang.Object
    • hashCode

      public int hashCode()
      Overrides:
      hashCode in class java.lang.Object
    • compareTo

      public int compareTo​(SearchShardIterator o)
      Specified by:
      compareTo in interface java.lang.Comparable<SearchShardIterator>