Class ShardSearchRequest

All Implemented Interfaces:
IndicesRequest, Writeable, org.elasticsearch.core.RefCounted, TaskAwareRequest

public class ShardSearchRequest extends TransportRequest implements IndicesRequest
Shard level request that represents a search. It provides all the methods that the SearchContext needs. Provides a cache key based on its content that can be used to cache shard level response.
  • Constructor Details

    • ShardSearchRequest

      public ShardSearchRequest(OriginalIndices originalIndices, SearchRequest searchRequest, ShardId shardId, int shardRequestIndex, int numberOfShards, AliasFilter aliasFilter, float indexBoost, long nowInMillis, @Nullable  clusterAlias)
    • ShardSearchRequest

      public ShardSearchRequest(OriginalIndices originalIndices, SearchRequest searchRequest, ShardId shardId, int shardRequestIndex, int numberOfShards, AliasFilter aliasFilter, float indexBoost, long nowInMillis, @Nullable  clusterAlias, ShardSearchContextId readerId, org.elasticsearch.core.TimeValue keepAlive)
    • ShardSearchRequest

      public ShardSearchRequest(ShardId shardId, [] types, long nowInMillis, AliasFilter aliasFilter)
    • ShardSearchRequest

      public ShardSearchRequest(StreamInput in) throws
      Throws:
    • ShardSearchRequest

      public ShardSearchRequest(ShardSearchRequest clone)
  • Method Details

    • writeTo

      public void writeTo(StreamOutput out) throws
      Description copied from interface: Writeable
      Write this into the StreamOutput.
      Specified by:
      writeTo in interface Writeable
      Overrides:
      writeTo in class TransportRequest
      Throws:
    • innerWriteTo

      protected final void innerWriteTo(StreamOutput out, boolean asKey) throws
      Throws:
    • indices

      public [] indices()
      Description copied from interface: IndicesRequest
      Returns the array of indices that the action relates to
      Specified by:
      indices in interface IndicesRequest
    • indicesOptions

      public IndicesOptions indicesOptions()
      Description copied from interface: IndicesRequest
      Returns the indices options used to resolve indices. They tell for instance whether a single index is accepted, whether an empty array will be converted to _all, and how wildcards will be expanded if needed.
      Specified by:
      indicesOptions in interface IndicesRequest
    • shardId

      public ShardId shardId()
    • types

      public [] types()
    • source

      public SearchSourceBuilder source()
    • getAliasFilter

      public AliasFilter getAliasFilter()
    • setAliasFilter

      public void setAliasFilter(AliasFilter aliasFilter)
    • source

      public void source(SearchSourceBuilder source)
    • shardRequestIndex

      public int shardRequestIndex()
      Returns the shard request ordinal that is used by the main search request to reference this shard.
    • numberOfShards

      public int numberOfShards()
    • searchType

      public SearchType searchType()
    • indexBoost

      public float indexBoost()
    • nowInMillis

      public long nowInMillis()
    • requestCache

      public  requestCache()
    • requestCache

      public void requestCache( requestCache)
    • allowPartialSearchResults

      public boolean allowPartialSearchResults()
    • scroll

      public Scroll scroll()
    • setBottomSortValues

      public void setBottomSortValues(SearchSortValuesAndFormats values)
      Sets the bottom sort values that can be used by the searcher to filter documents that are after it. This value is computed by coordinating nodes that throttles the query phase. After a partial merge of successful shards the sort values of the bottom top document are passed as an hint on subsequent shard requests.
    • getBottomSortValues

      public SearchSortValuesAndFormats getBottomSortValues()
    • canReturnNullResponseIfMatchNoDocs

      public boolean canReturnNullResponseIfMatchNoDocs()
      Returns true if the caller can handle null response QuerySearchResult.nullInstance(). Defaults to false since the coordinator node needs at least one shard response to build the global response.
    • canReturnNullResponseIfMatchNoDocs

      public void canReturnNullResponseIfMatchNoDocs(boolean value)
    • readerId

      public ShardSearchContextId readerId()
      Returns a non-null value if this request should execute using a specific point-in-time reader; otherwise, using the most up to date point-in-time reader.
    • keepAlive

      public org.elasticsearch.core.TimeValue keepAlive()
      Returns a non-null to specify the time to live of the point-in-time reader that is used to execute this request.
    • cacheKey

      public > differentiator) throws
      Returns the cache key for this shard search request, based on its content
      Throws:
    • getClusterAlias

      public  getClusterAlias()
    • createTask

      public Task createTask(long id,  type,  action, TaskId parentTaskId, <,​> headers)
      Description copied from interface: TaskAwareRequest
      Returns the task object that should be used to keep track of the processing of the request.
      Specified by:
      createTask in interface TaskAwareRequest
    • getDescription

      public  getDescription()
      Description copied from interface: TaskAwareRequest
      Returns optional description of the request to be displayed by the task manager
      Specified by:
      getDescription in interface TaskAwareRequest
    • getRewriteable

      public Rewriteable<Rewriteable> getRewriteable()
    • parseAliasFilter

      public static > filterParser, IndexMetadata metadata, ... aliasNames)
      Returns the filter associated with listed filtering aliases.

      The list of filtering aliases should be obtained by calling Metadata.filteringAliases. Returns null if no filtering is required.

    • getRuntimeMappings

      public final <,​> getRuntimeMappings()
    • getChannelVersion

      public Version getChannelVersion()
      Returns the minimum version of the channel that the request has been passed. If the request never passes around, then the channel version is Version.CURRENT; otherwise, it's the minimum version of the coordinating node and data node (and the proxy node in case the request is sent to the proxy node of the remote cluster before reaching the data node).