Class ShardSearchRequest
java.lang.Object
org.elasticsearch.transport.TransportMessage
org.elasticsearch.transport.TransportRequest
org.elasticsearch.search.internal.ShardSearchRequest
- All Implemented Interfaces:
IndicesRequest
,Writeable
,org.elasticsearch.core.RefCounted
,TaskAwareRequest
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 class org.elasticsearch.transport.TransportRequest
TransportRequest.Empty
Nested classes/interfaces inherited from interface org.elasticsearch.action.IndicesRequest
IndicesRequest.Replaceable
Nested classes/interfaces inherited from interface org.elasticsearch.common.io.stream.Writeable
Writeable.Reader<V>, Writeable.Writer<V>
-
Constructor Summary
ConstructorDescriptionShardSearchRequest(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, org.elasticsearch.core.TimeValue keepAlive)
ShardSearchRequest(ShardId shardId, String[] types, long nowInMillis, AliasFilter aliasFilter)
-
Method Summary
Modifier and TypeMethodDescriptionboolean
cacheKey(CheckedBiConsumer<ShardSearchRequest,StreamOutput,IOException> differentiator)
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)
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 managerfloat
String[]
indices()
Returns the array of indices that the action relates toReturns the indices options used to resolve indices.protected void
innerWriteTo(StreamOutput out, boolean asKey)
org.elasticsearch.core.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.elasticsearch.core.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.void
requestCache(Boolean requestCache)
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.shardId()
int
Returns the shard request ordinal that is used by the main search request to reference this shard.source()
void
source(SearchSourceBuilder source)
String[]
types()
void
writeTo(StreamOutput out)
Write this into the StreamOutput.Methods inherited from class org.elasticsearch.transport.TransportRequest
getParentTask, setParentTask, toString
Methods inherited from class org.elasticsearch.transport.TransportMessage
decRef, incRef, remoteAddress, remoteAddress, tryIncRef
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
Methods inherited from interface org.elasticsearch.action.IndicesRequest
allowsRemoteIndices, includeDataStreams
Methods inherited from interface org.elasticsearch.tasks.TaskAwareRequest
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, org.elasticsearch.core.TimeValue keepAlive) -
ShardSearchRequest
public ShardSearchRequest(ShardId shardId, String[] types, long nowInMillis, AliasFilter aliasFilter) -
ShardSearchRequest
- Throws:
IOException
-
ShardSearchRequest
-
-
Method Details
-
writeTo
Description copied from interface:Writeable
Write this into the StreamOutput.- Specified by:
writeTo
in interfaceWriteable
- Overrides:
writeTo
in classTransportRequest
- Throws:
IOException
-
innerWriteTo
- 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
-
types
-
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
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 BytesReference cacheKey(CheckedBiConsumer<ShardSearchRequest,StreamOutput,IOException> differentiator) throws IOExceptionReturns 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: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
-
getRewriteable
-
parseAliasFilter
public static QueryBuilder parseAliasFilter(org.elasticsearch.core.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
-
getChannelVersion
Returns the minimum version of the channel that the request has been passed. If the request never passes around, then the channel version isVersion.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).
-