Class BulkResponse

All Implemented Interfaces:
Iterable<BulkItemResponse>, Writeable, ChunkedToXContent, ChunkedToXContentObject, RefCounted

public class BulkResponse extends ActionResponse implements Iterable<BulkItemResponse>, ChunkedToXContentObject
A response of a bulk execution. Holding a response for each item responding (in order) of the bulk requests. Each item holds the index/type/id is operated on, and if it failed or not (with the failure message).
  • Field Details

  • Constructor Details

  • Method Details

    • getTook

      public TimeValue getTook()
      How long the bulk execution took. Excluding ingest preprocessing.
    • getIngestTook

      public TimeValue getIngestTook()
      If ingest is enabled returns the bulk ingest preprocessing time, otherwise 0 is returned.
    • getIngestTookInMillis

      public long getIngestTookInMillis()
      If ingest is enabled returns the bulk ingest preprocessing time. in milliseconds, otherwise -1 is returned.
    • hasFailures

      public boolean hasFailures()
      Has anything failed with the execution.
    • buildFailureMessage

      public String buildFailureMessage()
    • getItems

      public BulkItemResponse[] getItems()
      The items representing each action performed in the bulk operation (in the same order!).
    • iterator

      public Iterator<BulkItemResponse> iterator()
      Specified by:
      iterator in interface Iterable<BulkItemResponse>
    • writeTo

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

      public Iterator<? extends ToXContent> toXContentChunked(ToXContent.Params params)
      Description copied from interface: ChunkedToXContent
      Create an iterator of ToXContent chunks for a REST response. Each chunk is serialized with the same XContentBuilder and ToXContent.Params, which is also the same as the ToXContent.Params passed as the params argument. For best results, all chunks should be O(1) size. The last chunk in the iterator must always yield at least one byte of output. See also ChunkedToXContentHelper for some handy utilities.

      Note that chunked response bodies cannot send deprecation warning headers once transmission has started, so implementations must check for deprecated feature use before returning.

      Specified by:
      toXContentChunked in interface ChunkedToXContent
      Returns:
      iterator over chunks of ToXContent