Class FetchPhaseResponseChunk

java.lang.Object
org.elasticsearch.search.fetch.chunk.FetchPhaseResponseChunk
All Implemented Interfaces:
Closeable, AutoCloseable, Writeable, Releasable

public class FetchPhaseResponseChunk extends Object implements Writeable, Releasable
A single chunk of fetch results streamed from a data node to the coordinator. Contains sequence information to maintain correct ordering when chunks arrive out of order.

Supports zero-copy transport by separating header metadata from serialized hits. The header is created after hits are serialized (since we don't know hit count until the buffer is full), then combined using CompositeBytesReference to avoid copying.

  • Constructor Details

    • FetchPhaseResponseChunk

      public FetchPhaseResponseChunk(ShardId shardId, BytesReference serializedHits, int hitCount, int expectedTotalDocs, long sequenceStart)
      Creates a chunk with pre-serialized hits. Takes ownership of serializedHits - caller must not release it.
      Parameters:
      shardId - source shard
      serializedHits - pre-serialized hit bytes
      hitCount - number of hits in the serialized bytes
      expectedTotalDocs - total number of documents requested for this shard fetch operation across all chunks (derived from requested doc IDs, not an observed count of docs received so far)
      sequenceStart - sequence number of first hit for ordering
    • FetchPhaseResponseChunk

      public FetchPhaseResponseChunk(StreamInput in) throws IOException
      Deserializes from stream (receiving side).
      Throws:
      IOException
  • Method Details