Class QuerySearchResult

All Implemented Interfaces:
Writeable, org.elasticsearch.core.RefCounted

public final class QuerySearchResult extends SearchPhaseResult
  • Constructor Details

  • Method Details

    • nullInstance

      public static QuerySearchResult nullInstance()
      Returns an instance that contains no response.
    • isNull

      public boolean isNull()
      Returns true if the result doesn't contain any useful information. It is used by the search action to avoid creating an empty response on shard request that rewrites to match_no_docs. TODO: Currently we need the concrete aggregators to build empty responses. This means that we cannot build an empty response in the coordinating node so we rely on this hack to ensure that at least one shard returns a valid empty response. We should move the ability to create empty responses to aggregation builders in order to allow building empty responses directly from the coordinating node.
    • queryResult

      public QuerySearchResult queryResult()
      Description copied from class: SearchPhaseResult
      Returns the query result iff it's included in this response otherwise null
      Overrides:
      queryResult in class SearchPhaseResult
    • searchTimedOut

      public void searchTimedOut(boolean searchTimedOut)
    • searchTimedOut

      public boolean searchTimedOut()
    • terminatedEarly

      public void terminatedEarly(boolean terminatedEarly)
    • terminatedEarly

      public Boolean terminatedEarly()
    • topDocs

      public TopDocsAndMaxScore topDocs()
    • hasConsumedTopDocs

      public boolean hasConsumedTopDocs()
      Returns true iff the top docs have already been consumed.
    • consumeTopDocs

      public TopDocsAndMaxScore 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:
      IllegalStateException - if the top docs have already been consumed.
    • topDocs

      public void topDocs(TopDocsAndMaxScore topDocs, DocValueFormat[] sortValueFormats)
    • sortValueFormats

      public DocValueFormat[] sortValueFormats()
    • hasAggs

      public boolean hasAggs()
      Returns true if this query result has unconsumed aggregations
    • consumeAggs

      public InternalAggregations consumeAggs()
      Returns and nulls out the aggregation for this search results. This allows to free up memory once the aggregation is consumed.
      Throws:
      IllegalStateException - if the aggregations have already been consumed.
    • releaseAggs

      public void releaseAggs()
    • aggregations

      public void aggregations(InternalAggregations aggregations)
    • aggregations

      public DelayableWriteable<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:
      IllegalStateException - if the profiled result has already been consumed.
    • hasProfileResults

      public boolean hasProfileResults()
    • consumeAll

      public void consumeAll()
    • profileResults

      public void profileResults(ProfileShardResult shardResults)
      Sets the finalized profiling results for this query
      Parameters:
      shardResults - The finalized profile
    • 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()
      Returns true if this result has any suggest score docs
    • hasSearchContext

      public boolean hasSearchContext()
    • readFromWithId

      public void readFromWithId(ShardSearchContextId id, StreamInput in) throws IOException
      Throws:
      IOException
    • writeTo

      public void writeTo(StreamOutput out) throws IOException
      Description copied from interface: Writeable
      Write this into the StreamOutput.
      Specified by:
      writeTo in interface Writeable
      Overrides:
      writeTo in class SearchPhaseResult
      Throws:
      IOException
    • writeToNoId

      public void writeToNoId(StreamOutput out) throws IOException
      Throws:
      IOException
    • getTotalHits

      public org.apache.lucene.search.TotalHits getTotalHits()
    • getMaxScore

      public float getMaxScore()