java.lang.Object
org.elasticsearch.transport.TransportMessage
org.elasticsearch.transport.AbstractTransportRequest
org.elasticsearch.search.internal.ShardSearchRequest
- All Implemented Interfaces:
IndicesRequest,Writeable,RefCounted,TaskAwareRequest,TransportRequest
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.-
Nested Class Summary
Nested classes/interfaces inherited from interface org.elasticsearch.action.IndicesRequest
IndicesRequest.RemoteClusterShardRequest, IndicesRequest.Replaceable, IndicesRequest.SingleIndexNoWildcardsNested classes/interfaces inherited from interface org.elasticsearch.common.io.stream.Writeable
Writeable.Reader<V>, Writeable.Writer<V> -
Field Summary
Fields inherited from interface org.elasticsearch.core.RefCounted
ALWAYS_REFERENCED -
Constructor Summary
ConstructorsConstructorDescriptionShardSearchRequest(OriginalIndices originalIndices, SearchRequest searchRequest, ShardId shardId, int shardRequestIndex, int numberOfShards, AliasFilter aliasFilter, float indexBoost, long nowInMillis, String clusterAlias) ShardSearchRequest(OriginalIndices originalIndices, SearchRequest searchRequest, ShardId shardId, int shardRequestIndex, int numberOfShards, AliasFilter aliasFilter, float indexBoost, long nowInMillis, String clusterAlias, ShardSearchContextId readerId, TimeValue keepAlive) ShardSearchRequest(OriginalIndices originalIndices, ShardId shardId, int shardRequestIndex, int numberOfShards, SearchType searchType, SearchSourceBuilder source, Boolean requestCache, AliasFilter aliasFilter, float indexBoost, boolean allowPartialSearchResults, TimeValue scroll, long nowInMillis, String clusterAlias, ShardSearchContextId readerId, TimeValue keepAlive, long waitForCheckpoint, TimeValue waitForCheckpointsTimeout, boolean forceSyntheticSource) ShardSearchRequest(ShardId shardId, long nowInMillis, AliasFilter aliasFilter) ShardSearchRequest(ShardId shardId, long nowInMillis, AliasFilter aliasFilter, String clusterAlias) -
Method Summary
Modifier and TypeMethodDescriptionbooleancacheKey(CheckedBiConsumer<ShardSearchRequest, StreamOutput, IOException> differentiator) Returns the cache key for this shard search request, based on its contentbooleanReturns true if the caller can handle null responseQuerySearchResult.nullInstance().voidcanReturnNullResponseIfMatchNoDocs(boolean value) static longcomputeWaitForCheckpoint(Map<String, long[]> indexToWaitForCheckpoints, ShardId shardId, int shardRequestIndex) Returns the task object that should be used to keep track of the processing of the request.Returns the minimum version of the channel that the request has been passed.Returns optional description of the request to be displayed by the task managerfloatString[]indices()Returns the array of indices that the action relates toReturns the indices options used to resolve indices.protected final voidinnerWriteTo(StreamOutput out, boolean asKey) booleanShould this request forcesynthetic source? Use this to test if the mapping supports synthetic _source and to get a sense of the worst case performance.Returns a non-null to specify the time to live of the point-in-time reader that is used to execute this request.longintstatic QueryBuilderparseAliasFilter(CheckedFunction<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.voidrequestCache(Boolean requestCache) scroll()voidsetAliasFilter(AliasFilter aliasFilter) voidSets the bottom sort values that can be used by the searcher to filter documents that are after it.shardId()intReturns the shard request ordinal that is used by the main search request to reference this shard.source()voidsource(SearchSourceBuilder source) longvoidwriteTo(StreamOutput out) Write this into the StreamOutput.Methods inherited from class org.elasticsearch.transport.AbstractTransportRequest
getParentTask, getRequestId, remoteAddress, remoteAddress, setParentTask, setRequestId, toStringMethods inherited from class org.elasticsearch.transport.TransportMessage
decRef, hasReferences, incRef, tryIncRefMethods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, waitMethods inherited from interface org.elasticsearch.action.IndicesRequest
includeDataStreamsMethods inherited from interface org.elasticsearch.core.RefCounted
decRef, hasReferences, incRef, mustIncRef, tryIncRefMethods inherited from interface org.elasticsearch.tasks.TaskAwareRequest
createTask, setParentTask
-
Constructor Details
-
ShardSearchRequest
public ShardSearchRequest(OriginalIndices originalIndices, SearchRequest searchRequest, ShardId shardId, int shardRequestIndex, int numberOfShards, AliasFilter aliasFilter, float indexBoost, long nowInMillis, @Nullable String clusterAlias) -
ShardSearchRequest
public ShardSearchRequest(OriginalIndices originalIndices, SearchRequest searchRequest, ShardId shardId, int shardRequestIndex, int numberOfShards, AliasFilter aliasFilter, float indexBoost, long nowInMillis, @Nullable String clusterAlias, ShardSearchContextId readerId, TimeValue keepAlive) -
ShardSearchRequest
-
ShardSearchRequest
public ShardSearchRequest(ShardId shardId, long nowInMillis, AliasFilter aliasFilter, String clusterAlias) -
ShardSearchRequest
public ShardSearchRequest(OriginalIndices originalIndices, ShardId shardId, int shardRequestIndex, int numberOfShards, SearchType searchType, SearchSourceBuilder source, Boolean requestCache, AliasFilter aliasFilter, float indexBoost, boolean allowPartialSearchResults, TimeValue scroll, long nowInMillis, @Nullable String clusterAlias, ShardSearchContextId readerId, TimeValue keepAlive, long waitForCheckpoint, TimeValue waitForCheckpointsTimeout, boolean forceSyntheticSource) -
ShardSearchRequest
-
ShardSearchRequest
- Throws:
IOException
-
-
Method Details
-
computeWaitForCheckpoint
-
writeTo
Description copied from interface:WriteableWrite this into the StreamOutput.- Specified by:
writeToin interfaceWriteable- Overrides:
writeToin classAbstractTransportRequest- Throws:
IOException
-
innerWriteTo
- Throws:
IOException
-
indices
Description copied from interface:IndicesRequestReturns the array of indices that the action relates to- Specified by:
indicesin interfaceIndicesRequest
-
indicesOptions
Description copied from interface:IndicesRequestReturns 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:
indicesOptionsin interfaceIndicesRequest
-
shardId
-
source
-
getAliasFilter
-
setAliasFilter
-
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
-
indexBoost
public float indexBoost() -
nowInMillis
public long nowInMillis() -
requestCache
-
requestCache
-
allowPartialSearchResults
public boolean allowPartialSearchResults() -
scroll
-
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
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
-
cacheKey
public BytesReference cacheKey(CheckedBiConsumer<ShardSearchRequest, StreamOutput, throws IOExceptionIOException> differentiator) 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, TaskId parentTaskId, Map<String, String> headers) Description copied from interface:TaskAwareRequestReturns the task object that should be used to keep track of the processing of the request.- Specified by:
createTaskin interfaceTaskAwareRequest
-
getDescription
Description copied from interface:TaskAwareRequestReturns optional description of the request to be displayed by the task manager- Specified by:
getDescriptionin interfaceTaskAwareRequest
-
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
nullif no filtering is required. -
getRuntimeMappings
-
getChannelVersion
Returns the minimum version of the channel that the request has been passed. If the request never passes around, then the channel version isTransportVersion.current(); otherwise, it's the minimum transport 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). -
isForceSyntheticSource
public boolean isForceSyntheticSource()Should this request forcesynthetic source? Use this to test if the mapping supports synthetic _source and to get a sense of the worst case performance. Fetches with this enabled will be slower the enabling synthetic source natively in the index.
-