Class BulkItemResponse

java.lang.Object
org.elasticsearch.action.bulk.BulkItemResponse
All Implemented Interfaces:
Writeable, StatusToXContentObject, org.elasticsearch.common.xcontent.ToXContent, org.elasticsearch.common.xcontent.ToXContentObject

public class BulkItemResponse
extends java.lang.Object
implements Writeable, StatusToXContentObject
Represents a single item response for an action executed as part of the bulk API. Holds the index/type/id of the relevant action, and if it has failed or not (with the failure message in case it failed).
  • Nested Class Summary

    Nested Classes
    Modifier and Type Class Description
    static class  BulkItemResponse.Failure
    Represents a failure.

    Nested classes/interfaces inherited from interface org.elasticsearch.common.xcontent.ToXContent

    org.elasticsearch.common.xcontent.ToXContent.DelegatingMapParams, org.elasticsearch.common.xcontent.ToXContent.MapParams, org.elasticsearch.common.xcontent.ToXContent.Params

    Nested classes/interfaces inherited from interface org.elasticsearch.common.io.stream.Writeable

    Writeable.Reader<V>, Writeable.Writer<V>
  • Field Summary

    Fields inherited from interface org.elasticsearch.common.xcontent.ToXContent

    EMPTY_PARAMS
  • Constructor Summary

    Constructors
    Constructor Description
    BulkItemResponse​(int id, DocWriteRequest.OpType opType, BulkItemResponse.Failure failure)  
    BulkItemResponse​(int id, DocWriteRequest.OpType opType, DocWriteResponse response)  
  • Method Summary

    Modifier and Type Method Description
    static BulkItemResponse fromXContent​(org.elasticsearch.common.xcontent.XContentParser parser, int id)
    Reads a BulkItemResponse from a XContentParser.
    BulkItemResponse.Failure getFailure()
    The actual failure object if there was a failure.
    java.lang.String getFailureMessage()
    The failure message, null if it did not fail.
    java.lang.String getId()
    The id of the action.
    java.lang.String getIndex()
    The index name of the action.
    int getItemId()
    The numeric order of the item matching the same request order in the bulk request.
    DocWriteRequest.OpType getOpType()
    The operation type ("index", "create" or "delete").
    <T extends DocWriteResponse>
    T
    getResponse()
    The actual response (IndexResponse or DeleteResponse).
    java.lang.String getType()
    The type of the action.
    long getVersion()
    The version of the action.
    boolean isFailed()
    Is this a failed execution of an operation.
    RestStatus status()
    Returns the REST status to make sure it is returned correctly
    org.elasticsearch.common.xcontent.XContentBuilder toXContent​(org.elasticsearch.common.xcontent.XContentBuilder builder, org.elasticsearch.common.xcontent.ToXContent.Params params)  
    void writeThin​(StreamOutput out)  
    void writeTo​(StreamOutput out)
    Write this into the StreamOutput.

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait

    Methods inherited from interface org.elasticsearch.common.xcontent.ToXContentObject

    isFragment
  • Constructor Details

  • Method Details

    • status

      public RestStatus status()
      Description copied from interface: StatusToXContentObject
      Returns the REST status to make sure it is returned correctly
      Specified by:
      status in interface StatusToXContentObject
    • toXContent

      public org.elasticsearch.common.xcontent.XContentBuilder toXContent​(org.elasticsearch.common.xcontent.XContentBuilder builder, org.elasticsearch.common.xcontent.ToXContent.Params params) throws java.io.IOException
      Specified by:
      toXContent in interface org.elasticsearch.common.xcontent.ToXContent
      Throws:
      java.io.IOException
    • fromXContent

      public static BulkItemResponse fromXContent​(org.elasticsearch.common.xcontent.XContentParser parser, int id) throws java.io.IOException
      Reads a BulkItemResponse from a XContentParser.
      Parameters:
      parser - the XContentParser
      id - the id to assign to the parsed BulkItemResponse. It is usually the index of the item in the BulkResponse.getItems() array.
      Throws:
      java.io.IOException
    • getItemId

      public int getItemId()
      The numeric order of the item matching the same request order in the bulk request.
    • getOpType

      public DocWriteRequest.OpType getOpType()
      The operation type ("index", "create" or "delete").
    • getIndex

      public java.lang.String getIndex()
      The index name of the action.
    • getType

      public java.lang.String getType()
      The type of the action.
    • getId

      public java.lang.String getId()
      The id of the action.
    • getVersion

      public long getVersion()
      The version of the action.
    • getResponse

      public <T extends DocWriteResponse> T getResponse()
      The actual response (IndexResponse or DeleteResponse). null in case of failure.
    • isFailed

      public boolean isFailed()
      Is this a failed execution of an operation.
    • getFailureMessage

      public java.lang.String getFailureMessage()
      The failure message, null if it did not fail.
    • getFailure

      public BulkItemResponse.Failure getFailure()
      The actual failure object if there was a failure.
    • writeTo

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

      public void writeThin​(StreamOutput out) throws java.io.IOException
      Throws:
      java.io.IOException