Class SearchPhaseResult

java.lang.Object
All Implemented Interfaces:
Writeable, org.elasticsearch.common.util.concurrent.RefCounted
Direct Known Subclasses:
DfsSearchResult, FetchSearchResult, QueryFetchSearchResult, QuerySearchResult, ScrollQueryFetchSearchResult, ScrollQuerySearchResult, SearchService.CanMatchResponse

public abstract class SearchPhaseResult
extends TransportResponse
This class is a base class for all search related results. It contains the shard target it was executed against, a shard index used to reference the result on the coordinating node and a request ID that is used to reference the request context on the executing node. The request ID is particularly important since it is used to reference and maintain a context across search phases to ensure the same point in time snapshot is used for querying and fetching etc.
  • Field Details

  • Constructor Details

    • SearchPhaseResult

      protected SearchPhaseResult()
    • SearchPhaseResult

      protected SearchPhaseResult​(StreamInput in) throws java.io.IOException
      Throws:
      java.io.IOException
  • Method Details

    • getContextId

      @Nullable public ShardSearchContextId getContextId()
      Returns the search context ID that is used to reference the search context on the executing node or null if no context was created.
    • getShardIndex

      public int getShardIndex()
      Returns the shard index in the context of the currently executing search request that is used for accounting on the coordinating node
    • getSearchShardTarget

      public SearchShardTarget getSearchShardTarget()
    • setSearchShardTarget

      public void setSearchShardTarget​(SearchShardTarget shardTarget)
    • setShardIndex

      public void setShardIndex​(int shardIndex)
    • queryResult

      public QuerySearchResult queryResult()
      Returns the query result iff it's included in this response otherwise null
    • fetchResult

      public FetchSearchResult fetchResult()
      Returns the fetch result iff it's included in this response otherwise null
    • getShardSearchRequest

      @Nullable public ShardSearchRequest getShardSearchRequest()
    • setShardSearchRequest

      public void setShardSearchRequest​(ShardSearchRequest shardSearchRequest)
    • getRescoreDocIds

      public RescoreDocIds getRescoreDocIds()
    • setRescoreDocIds

      public void setRescoreDocIds​(RescoreDocIds rescoreDocIds)
    • writeTo

      public void writeTo​(StreamOutput out) throws java.io.IOException
      Description copied from interface: Writeable
      Write this into the StreamOutput.
      Throws:
      java.io.IOException