Package org.elasticsearch.search.query
Class QuerySearchResult
- java.lang.Object
-
- org.elasticsearch.transport.TransportMessage
-
- org.elasticsearch.transport.TransportResponse
-
- org.elasticsearch.search.SearchPhaseResult
-
- org.elasticsearch.search.query.QuerySearchResult
-
- All Implemented Interfaces:
Streamable
,Writeable
public final class QuerySearchResult extends SearchPhaseResult
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from class org.elasticsearch.transport.TransportResponse
TransportResponse.Empty
-
Nested classes/interfaces inherited from interface org.elasticsearch.common.io.stream.Writeable
Writeable.Reader<V>, Writeable.Writer<V>
-
-
Field Summary
-
Fields inherited from class org.elasticsearch.search.SearchPhaseResult
requestId
-
-
Constructor Summary
Constructors Constructor Description QuerySearchResult()
QuerySearchResult(long id, SearchShardTarget shardTarget)
QuerySearchResult(StreamInput in)
-
Method Summary
Modifier and Type Method Description void
aggregations(InternalAggregations aggregations)
Aggregations
consumeAggs()
Returns and nulls out the aggregation for this search results.ProfileShardResult
consumeProfileResult()
Returns and nulls out the profiled results for this search, or potentially null if result was empty.org.apache.lucene.search.TopDocs
consumeTopDocs()
Returns and nulls out the top docs for this search results.int
from()
QuerySearchResult
from(int from)
float
getMaxScore()
long
getTotalHits()
boolean
hasAggs()
Returnstrue
if this query result has unconsumed aggregationsboolean
hasConsumedTopDocs()
Returnstrue
iff the top docs have already been consumed.boolean
hasProfileResults()
boolean
hasSearchContext()
boolean
hasSuggestHits()
Returnstrue
if this result has any suggest score docsint
nodeQueueSize()
QuerySearchResult
nodeQueueSize(int nodeQueueSize)
java.util.List<SiblingPipelineAggregator>
pipelineAggregators()
void
pipelineAggregators(java.util.List<SiblingPipelineAggregator> pipelineAggregators)
void
profileResults(ProfileShardResult shardResults)
Sets the finalized profiling results for this queryQuerySearchResult
queryResult()
Returns the query result iff it's included in this response otherwisenull
void
readFrom(StreamInput in)
Set this object's fields from a StreamInput.void
readFromWithId(long id, StreamInput in)
static QuerySearchResult
readQuerySearchResult(StreamInput in)
boolean
searchTimedOut()
void
searchTimedOut(boolean searchTimedOut)
long
serviceTimeEWMA()
QuerySearchResult
serviceTimeEWMA(long serviceTimeEWMA)
int
size()
Returns the maximum size of this results top docs.QuerySearchResult
size(int size)
DocValueFormat[]
sortValueFormats()
Suggest
suggest()
void
suggest(Suggest suggest)
java.lang.Boolean
terminatedEarly()
void
terminatedEarly(boolean terminatedEarly)
org.apache.lucene.search.TopDocs
topDocs()
void
topDocs(org.apache.lucene.search.TopDocs topDocs, DocValueFormat[] sortValueFormats)
void
writeTo(StreamOutput out)
Write this object's fields to a StreamOutput.void
writeToNoId(StreamOutput out)
-
Methods inherited from class org.elasticsearch.search.SearchPhaseResult
fetchResult, getRequestId, getSearchShardTarget, getShardIndex, setSearchShardTarget, setShardIndex
-
Methods inherited from class org.elasticsearch.transport.TransportMessage
remoteAddress, remoteAddress
-
-
-
-
Constructor Detail
-
QuerySearchResult
public QuerySearchResult()
-
QuerySearchResult
public QuerySearchResult(StreamInput in) throws java.io.IOException
- Throws:
java.io.IOException
-
QuerySearchResult
public QuerySearchResult(long id, SearchShardTarget shardTarget)
-
-
Method Detail
-
queryResult
public QuerySearchResult queryResult()
Description copied from class:SearchPhaseResult
Returns the query result iff it's included in this response otherwisenull
- Overrides:
queryResult
in classSearchPhaseResult
-
searchTimedOut
public void searchTimedOut(boolean searchTimedOut)
-
searchTimedOut
public boolean searchTimedOut()
-
terminatedEarly
public void terminatedEarly(boolean terminatedEarly)
-
terminatedEarly
public java.lang.Boolean terminatedEarly()
-
topDocs
public org.apache.lucene.search.TopDocs topDocs()
-
hasConsumedTopDocs
public boolean hasConsumedTopDocs()
Returnstrue
iff the top docs have already been consumed.
-
consumeTopDocs
public org.apache.lucene.search.TopDocs consumeTopDocs()
Returns and nulls out the top docs for this search results. This allows to free up memory once the top docs are consumed.- Throws:
java.lang.IllegalStateException
- if the top docs have already been consumed.
-
topDocs
public void topDocs(org.apache.lucene.search.TopDocs topDocs, DocValueFormat[] sortValueFormats)
-
sortValueFormats
public DocValueFormat[] sortValueFormats()
-
hasAggs
public boolean hasAggs()
Returnstrue
if this query result has unconsumed aggregations
-
consumeAggs
public Aggregations consumeAggs()
Returns and nulls out the aggregation for this search results. This allows to free up memory once the aggregation is consumed.- Throws:
java.lang.IllegalStateException
- if the aggregations have already been consumed.
-
aggregations
public void aggregations(InternalAggregations aggregations)
-
consumeProfileResult
public ProfileShardResult consumeProfileResult()
Returns and nulls out the profiled results for this search, or potentially null if result was empty. This allows to free up memory once the profiled result is consumed.- Throws:
java.lang.IllegalStateException
- if the profiled result has already been consumed.
-
hasProfileResults
public boolean hasProfileResults()
-
profileResults
public void profileResults(ProfileShardResult shardResults)
Sets the finalized profiling results for this query- Parameters:
shardResults
- The finalized profile
-
pipelineAggregators
public java.util.List<SiblingPipelineAggregator> pipelineAggregators()
-
pipelineAggregators
public void pipelineAggregators(java.util.List<SiblingPipelineAggregator> pipelineAggregators)
-
suggest
public Suggest suggest()
-
suggest
public void suggest(Suggest suggest)
-
from
public int from()
-
from
public QuerySearchResult from(int from)
-
size
public int size()
Returns the maximum size of this results top docs.
-
size
public QuerySearchResult size(int size)
-
serviceTimeEWMA
public long serviceTimeEWMA()
-
serviceTimeEWMA
public QuerySearchResult serviceTimeEWMA(long serviceTimeEWMA)
-
nodeQueueSize
public int nodeQueueSize()
-
nodeQueueSize
public QuerySearchResult nodeQueueSize(int nodeQueueSize)
-
hasSuggestHits
public boolean hasSuggestHits()
Returnstrue
if this result has any suggest score docs
-
hasSearchContext
public boolean hasSearchContext()
-
readQuerySearchResult
public static QuerySearchResult readQuerySearchResult(StreamInput in) throws java.io.IOException
- Throws:
java.io.IOException
-
readFrom
public void readFrom(StreamInput in) throws java.io.IOException
Description copied from interface:Streamable
Set this object's fields from a StreamInput.- Specified by:
readFrom
in interfaceStreamable
- Overrides:
readFrom
in classTransportMessage
- Throws:
java.io.IOException
-
readFromWithId
public void readFromWithId(long id, StreamInput in) throws java.io.IOException
- Throws:
java.io.IOException
-
writeTo
public void writeTo(StreamOutput out) throws java.io.IOException
Description copied from interface:Streamable
Write this object's fields to a StreamOutput.- Specified by:
writeTo
in interfaceStreamable
- Specified by:
writeTo
in interfaceWriteable
- Overrides:
writeTo
in classTransportMessage
- Throws:
java.io.IOException
-
writeToNoId
public void writeToNoId(StreamOutput out) throws java.io.IOException
- Throws:
java.io.IOException
-
getTotalHits
public long getTotalHits()
-
getMaxScore
public float getMaxScore()
-
-