Class ShardSearchRequest

java.lang.Object
org.opensearch.core.transport.TransportMessage
org.opensearch.transport.TransportRequest
org.opensearch.search.internal.ShardSearchRequest
All Implemented Interfaces:
IndicesRequest, org.opensearch.core.common.io.stream.Writeable, TaskAwareRequest

@PublicApi(since="1.0.0") 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.
Opensearch.api:
  • Field Details

    • FORMAT_PARAMS

      public static final org.opensearch.core.xcontent.ToXContent.Params FORMAT_PARAMS
  • Constructor Details

    • ShardSearchRequest

      public ShardSearchRequest(OriginalIndices originalIndices, SearchRequest searchRequest, org.opensearch.core.index.shard.ShardId shardId, int numberOfShards, AliasFilter aliasFilter, float indexBoost, long nowInMillis, @Nullable String clusterAlias, String[] indexRoutings)
    • ShardSearchRequest

      public ShardSearchRequest(OriginalIndices originalIndices, SearchRequest searchRequest, org.opensearch.core.index.shard.ShardId shardId, int numberOfShards, AliasFilter aliasFilter, float indexBoost, long nowInMillis, @Nullable String clusterAlias, String[] indexRoutings, ShardSearchContextId readerId, org.opensearch.common.unit.TimeValue keepAlive)
    • ShardSearchRequest

      public ShardSearchRequest(org.opensearch.core.index.shard.ShardId shardId, long nowInMillis, AliasFilter aliasFilter)
    • ShardSearchRequest

      public ShardSearchRequest(org.opensearch.core.common.io.stream.StreamInput in) throws IOException
      Throws:
      IOException
    • ShardSearchRequest

      public ShardSearchRequest(ShardSearchRequest clone)
  • Method Details

    • writeTo

      public void writeTo(org.opensearch.core.common.io.stream.StreamOutput out) throws IOException
      Specified by:
      writeTo in interface org.opensearch.core.common.io.stream.Writeable
      Overrides:
      writeTo in class TransportRequest
      Throws:
      IOException
    • innerWriteTo

      protected final void innerWriteTo(org.opensearch.core.common.io.stream.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 org.opensearch.core.index.shard.ShardId shardId()
    • source

      public SearchSourceBuilder source()
    • getAliasFilter

      public AliasFilter getAliasFilter()
    • setAliasFilter

      public void setAliasFilter(AliasFilter aliasFilter)
    • source

      public void source(SearchSourceBuilder source)
    • numberOfShards

      public int numberOfShards()
    • searchType

      public SearchType searchType()
    • indexBoost

      public float indexBoost()
    • nowInMillis

      public long nowInMillis()
    • getInboundNetworkTime

      public long getInboundNetworkTime()
    • setInboundNetworkTime

      public void setInboundNetworkTime(long newTime)
    • getOutboundNetworkTime

      public long getOutboundNetworkTime()
    • setOutboundNetworkTime

      public void setOutboundNetworkTime(long newTime)
    • requestCache

      public Boolean requestCache()
    • allowPartialSearchResults

      public boolean allowPartialSearchResults()
    • scroll

      public Scroll scroll()
    • indexRoutings

      public String[] indexRoutings()
    • preference

      public String preference()
    • 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.opensearch.common.unit.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 org.opensearch.core.common.bytes.BytesReference cacheKey() throws IOException
      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, org.opensearch.core.tasks.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
    • getMetadataSupplier

      public String getMetadataSupplier()
    • getRewriteable

      public Rewriteable<Rewriteable> getRewriteable()
    • parseAliasFilter

      public static QueryBuilder parseAliasFilter(org.opensearch.common.CheckedFunction<org.opensearch.core.common.bytes.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.