Class ShardSearchRequest
java.lang.Object
org.elasticsearch.transport.TransportMessage
org.elasticsearch.transport.TransportRequest
org.elasticsearch.search.internal.ShardSearchRequest
- All Implemented Interfaces:
IndicesRequest
,Writeable
,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.-
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
Constructors Constructor Description ShardSearchRequest(OriginalIndices originalIndices, SearchRequest searchRequest, ShardId shardId, int numberOfShards, AliasFilter aliasFilter, float indexBoost, long nowInMillis, java.lang.String clusterAlias, java.lang.String[] indexRoutings)
ShardSearchRequest(StreamInput in)
ShardSearchRequest(ShardId shardId, java.lang.String[] types, long nowInMillis, AliasFilter aliasFilter)
ShardSearchRequest(ShardSearchRequest clone)
-
Method Summary
Modifier and Type Method Description boolean
allowPartialSearchResults()
BytesReference
cacheKey()
Returns the cache key for this shard search request, based on its contentboolean
canReturnNullResponseIfMatchNoDocs()
Returns true if the caller can handle null responseQuerySearchResult.nullInstance()
.void
canReturnNullResponseIfMatchNoDocs(boolean value)
Task
createTask(long id, java.lang.String type, java.lang.String action, TaskId parentTaskId, java.util.Map<java.lang.String,java.lang.String> headers)
Returns the task object that should be used to keep track of the processing of the request.AliasFilter
getAliasFilter()
SearchSortValuesAndFormats
getBottomSortValues()
java.lang.String
getClusterAlias()
java.lang.String
getDescription()
Returns optional description of the request to be displayed by the task managerRewriteable<Rewriteable>
getRewriteable()
float
indexBoost()
java.lang.String[]
indexRoutings()
java.lang.String[]
indices()
Returns the array of indices that the action relates toIndicesOptions
indicesOptions()
Returns the indices options used to resolve indices.protected void
innerWriteTo(StreamOutput out, boolean asKey)
long
nowInMillis()
int
numberOfShards()
static QueryBuilder
parseAliasFilter(CheckedFunction<byte[],QueryBuilder,java.io.IOException> filterParser, IndexMetaData metaData, java.lang.String... aliasNames)
Returns the filter associated with listed filtering aliases.java.lang.String
preference()
java.lang.Boolean
requestCache()
Scroll
scroll()
SearchType
searchType()
void
setAliasFilter(AliasFilter aliasFilter)
void
setBottomSortValues(SearchSortValuesAndFormats values)
Sets the bottom sort values that can be used by the searcher to filter documents that are after it.ShardId
shardId()
SearchSourceBuilder
source()
void
source(SearchSourceBuilder source)
java.lang.String[]
types()
void
writeTo(StreamOutput out)
Write this into the StreamOutput.Methods inherited from class org.elasticsearch.transport.TransportRequest
getParentTask, setParentTask
Methods inherited from class org.elasticsearch.transport.TransportMessage
remoteAddress, remoteAddress
-
Constructor Details
-
ShardSearchRequest
public ShardSearchRequest(OriginalIndices originalIndices, SearchRequest searchRequest, ShardId shardId, int numberOfShards, AliasFilter aliasFilter, float indexBoost, long nowInMillis, @Nullable java.lang.String clusterAlias, java.lang.String[] indexRoutings) -
ShardSearchRequest
public ShardSearchRequest(ShardId shardId, java.lang.String[] types, long nowInMillis, AliasFilter aliasFilter) -
ShardSearchRequest
- Throws:
java.io.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:
java.io.IOException
-
innerWriteTo
- Throws:
java.io.IOException
-
indices
public java.lang.String[] 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
public java.lang.String[] types() -
source
-
getAliasFilter
-
setAliasFilter
-
source
-
numberOfShards
public int numberOfShards() -
searchType
-
indexBoost
public float indexBoost() -
nowInMillis
public long nowInMillis() -
requestCache
public java.lang.Boolean requestCache() -
allowPartialSearchResults
public boolean allowPartialSearchResults() -
scroll
-
indexRoutings
public java.lang.String[] indexRoutings() -
preference
public java.lang.String 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) -
cacheKey
Returns the cache key for this shard search request, based on its content- Throws:
java.io.IOException
-
getClusterAlias
public java.lang.String getClusterAlias() -
createTask
public Task createTask(long id, java.lang.String type, java.lang.String action, TaskId parentTaskId, java.util.Map<java.lang.String,java.lang.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
public java.lang.String 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(CheckedFunction<byte[],QueryBuilder,java.io.IOException> filterParser, IndexMetaData metaData, java.lang.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.
-