Package org.opensearch.search.internal
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:
-
Nested Class Summary
Nested classes/interfaces inherited from class org.opensearch.transport.TransportRequest
TransportRequest.Empty
Nested classes/interfaces inherited from interface org.opensearch.action.IndicesRequest
IndicesRequest.Replaceable
Nested classes/interfaces inherited from interface org.opensearch.core.common.io.stream.Writeable
org.opensearch.core.common.io.stream.Writeable.Reader<V>, org.opensearch.core.common.io.stream.Writeable.WriteableRegistry, org.opensearch.core.common.io.stream.Writeable.Writer<V>
-
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final org.opensearch.core.xcontent.ToXContent.Params
-
Constructor Summary
ConstructorsConstructorDescriptionShardSearchRequest
(OriginalIndices originalIndices, SearchRequest searchRequest, org.opensearch.core.index.shard.ShardId shardId, int numberOfShards, AliasFilter aliasFilter, float indexBoost, long nowInMillis, String clusterAlias, String[] indexRoutings) ShardSearchRequest
(OriginalIndices originalIndices, SearchRequest searchRequest, org.opensearch.core.index.shard.ShardId shardId, int numberOfShards, AliasFilter aliasFilter, float indexBoost, long nowInMillis, String clusterAlias, String[] indexRoutings, ShardSearchContextId readerId, org.opensearch.common.unit.TimeValue keepAlive) ShardSearchRequest
(org.opensearch.core.common.io.stream.StreamInput in) ShardSearchRequest
(org.opensearch.core.index.shard.ShardId shardId, long nowInMillis, AliasFilter aliasFilter) -
Method Summary
Modifier and TypeMethodDescriptionboolean
org.opensearch.core.common.bytes.BytesReference
cacheKey()
Returns the cache key for this shard search request, based on its contentboolean
Returns true if the caller can handle null responseQuerySearchResult.nullInstance()
.void
canReturnNullResponseIfMatchNoDocs
(boolean value) createTask
(long id, String type, String action, org.opensearch.core.tasks.TaskId parentTaskId, Map<String, String> headers) Returns the task object that should be used to keep track of the processing of the request.Returns optional description of the request to be displayed by the task managerlong
long
float
String[]
String[]
indices()
Returns the array of indices that the action relates toReturns the indices options used to resolve indices.protected final void
innerWriteTo
(org.opensearch.core.common.io.stream.StreamOutput out, boolean asKey) org.opensearch.common.unit.TimeValue
Returns a non-null to specify the time to live of the point-in-time reader that is used to execute this request.long
int
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.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.scroll()
void
setAliasFilter
(AliasFilter aliasFilter) void
Sets the bottom sort values that can be used by the searcher to filter documents that are after it.void
setInboundNetworkTime
(long newTime) void
setOutboundNetworkTime
(long newTime) org.opensearch.core.index.shard.ShardId
shardId()
source()
void
source
(SearchSourceBuilder source) void
writeTo
(org.opensearch.core.common.io.stream.StreamOutput out) Methods inherited from class org.opensearch.transport.TransportRequest
getParentTask, setParentTask
Methods inherited from class org.opensearch.core.transport.TransportMessage
remoteAddress, remoteAddress
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
Methods inherited from interface org.opensearch.action.IndicesRequest
includeDataStreams
Methods inherited from interface org.opensearch.tasks.TaskAwareRequest
setParentTask
-
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
- Throws:
IOException
-
ShardSearchRequest
-
-
Method Details
-
writeTo
- Specified by:
writeTo
in interfaceorg.opensearch.core.common.io.stream.Writeable
- Overrides:
writeTo
in classTransportRequest
- Throws:
IOException
-
innerWriteTo
protected final void innerWriteTo(org.opensearch.core.common.io.stream.StreamOutput out, boolean asKey) throws IOException - Throws:
IOException
-
indices
Description copied from interface:IndicesRequest
Returns the array of indices that the action relates to- Specified by:
indices
in interfaceIndicesRequest
-
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 interfaceIndicesRequest
-
shardId
public org.opensearch.core.index.shard.ShardId shardId() -
source
-
getAliasFilter
-
setAliasFilter
-
source
-
numberOfShards
public int numberOfShards() -
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
-
allowPartialSearchResults
public boolean allowPartialSearchResults() -
scroll
-
indexRoutings
-
preference
-
setBottomSortValues
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
-
canReturnNullResponseIfMatchNoDocs
public boolean canReturnNullResponseIfMatchNoDocs()Returns true if the caller can handle null responseQuerySearchResult.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
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
Returns the cache key for this shard search request, based on its content- Throws:
IOException
-
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 interfaceTaskAwareRequest
-
getDescription
Description copied from interface:TaskAwareRequest
Returns optional description of the request to be displayed by the task manager- Specified by:
getDescription
in interfaceTaskAwareRequest
-
getMetadataSupplier
-
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.
-