Class FetchSearchResult

All Implemented Interfaces:
Writeable, RefCounted

public final class FetchSearchResult extends SearchPhaseResult
  • Constructor Details

  • Method Details

    • 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
    • fetchResult

      public FetchSearchResult fetchResult()
      Description copied from class: SearchPhaseResult
      Returns the fetch result iff it's included in this response otherwise null
      Overrides:
      fetchResult in class SearchPhaseResult
    • shardResult

      public void shardResult(SearchHits hits, ProfileResult profileResult)
    • hits

      public SearchHits hits()
    • setSearchHitsSizeBytes

      public void setSearchHitsSizeBytes(long bytes)
    • getSearchHitsSizeBytes

      public long getSearchHitsSizeBytes()
    • releaseCircuitBreakerBytes

      public void releaseCircuitBreakerBytes(CircuitBreaker circuitBreaker)
    • initCounter

      public FetchSearchResult initCounter()
    • counterGetAndIncrement

      public int counterGetAndIncrement()
    • profileResult

      public ProfileResult profileResult()
    • incRef

      public void incRef()
      Specified by:
      incRef in interface RefCounted
      Overrides:
      incRef in class TransportMessage
    • tryIncRef

      public boolean tryIncRef()
      Specified by:
      tryIncRef in interface RefCounted
      Overrides:
      tryIncRef in class TransportMessage
    • decRef

      public boolean decRef()
      Description copied from class: TransportMessage
      Note that the lifetime of an outbound TransportMessage lasts at least until it has been fully sent over the network, and it may be closed on a network thread in a context in which there's a risk of stack overflows if on close it calls back into the network layer in a manner that might end up nesting too deeply. When in doubt, dispatch any further work onto a separate thread.
      Specified by:
      decRef in interface RefCounted
      Overrides:
      decRef in class TransportMessage
    • hasReferences

      public boolean hasReferences()
      Specified by:
      hasReferences in interface RefCounted
      Overrides:
      hasReferences in class TransportMessage
    • setLastChunkSequenceStart

      public void setLastChunkSequenceStart(long sequenceStart)
      Sets the sequence start for the last chunk embedded in this result. Called on the data node after iterating fetch phase results.
      Parameters:
      sequenceStart - the sequence number of the first hit in the last chunk
    • getLastChunkSequenceStart

      public long getLastChunkSequenceStart()
      Gets the sequence start for the last chunk embedded in this result. Used by the coordinator to properly order last chunk hits with other chunks.
      Returns:
      the sequence number of the first hit in the last chunk, or -1 if not set
    • setLastChunkBytes

      public void setLastChunkBytes(BytesReference bytes, int hitCount)
      Sets the raw bytes of the last chunk. Called on the data node in chunked fetch mode to avoid deserializing large hit data that would cause OOM.

      Takes ownership of the bytes reference - caller must not release it.

      Parameters:
      bytes - the serialized hit bytes
      hitCount - the number of hits in the bytes
    • getLastChunkBytes

      public BytesReference getLastChunkBytes()
      Gets the raw bytes of the last chunk. Used by the coordinator to deserialize and merge with other accumulated chunks.
      Returns:
      the serialized hit bytes, or null if not set
    • getLastChunkHitCount

      public int getLastChunkHitCount()
      Gets the number of hits in the last chunk bytes.
      Returns:
      the hit count, or 0 if no last chunk