Class ShardSearchRequest

All Implemented Interfaces:
IndicesRequest, Writeable, 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

  • Method Details

    • computeWaitForCheckpoint

      public static long computeWaitForCheckpoint(Map<String,long[]> indexToWaitForCheckpoints, ShardId shardId, int shardRequestIndex)
    • writeTo

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

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

      public String[] 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 String[] 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 Boolean requestCache()
    • requestCache

      public void requestCache(Boolean 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 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.
    • waitForCheckpoint

      public long waitForCheckpoint()
    • getWaitForCheckpointsTimeout

      public TimeValue getWaitForCheckpointsTimeout()
    • cacheKey

      Returns the cache key for this shard search request, based on its content
      Throws:
      IOException
    • getClusterAlias

      public String getClusterAlias()
    • createTask

      public Task createTask(long id, String type, String action, TaskId parentTaskId, Map<String,String> 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 String 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 QueryBuilder parseAliasFilter(CheckedFunction<BytesReference,QueryBuilder,IOException> filterParser, IndexMetadata metadata, String... 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 Map<String,Object> 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).