Package org.elasticsearch.action.bulk
Class BulkItemResponse
java.lang.Object
org.elasticsearch.action.bulk.BulkItemResponse
- All Implemented Interfaces:
Writeable,StatusToXContentObject,ToXContent,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 incase it failed).
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static classBulkItemResponse.FailureRepresents a failure.Nested classes/interfaces inherited from interface org.elasticsearch.common.xcontent.ToXContent
ToXContent.DelegatingMapParams, ToXContent.MapParams, ToXContent.ParamsNested classes/interfaces inherited from interface org.elasticsearch.common.io.stream.Writeable
Writeable.Reader<V>, Writeable.Writer<V> -
Field Summary
-
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 BulkItemResponsefromXContent(XContentParser parser, int id)Reads aBulkItemResponsefrom aXContentParser.BulkItemResponse.FailuregetFailure()The actual failure object if there was a failure.java.lang.StringgetFailureMessage()The failure message,nullif it did not fail.java.lang.StringgetId()The id of the action.java.lang.StringgetIndex()The index name of the action.intgetItemId()The numeric order of the item matching the same request order in the bulk request.DocWriteRequest.OpTypegetOpType()The operation type ("index", "create" or "delete").<T extends DocWriteResponse>
TgetResponse()The actual response (IndexResponseorDeleteResponse).java.lang.StringgetType()The type of the action.longgetVersion()The version of the action.booleanisFailed()Is this a failed execution of an operation.RestStatusstatus()Returns the REST status to make sure it is returned correctlyXContentBuildertoXContent(XContentBuilder builder, ToXContent.Params params)voidwriteTo(StreamOutput out)Write this into the StreamOutput.
-
Constructor Details
-
Method Details
-
status
Description copied from interface:StatusToXContentObjectReturns the REST status to make sure it is returned correctly- Specified by:
statusin interfaceStatusToXContentObject
-
toXContent
public XContentBuilder toXContent(XContentBuilder builder, ToXContent.Params params) throws java.io.IOException- Specified by:
toXContentin interfaceToXContent- Throws:
java.io.IOException
-
fromXContent
public static BulkItemResponse fromXContent(XContentParser parser, int id) throws java.io.IOExceptionReads aBulkItemResponsefrom aXContentParser.- Parameters:
parser- theXContentParserid- the id to assign to the parsedBulkItemResponse. It is usually the index of the item in theBulkResponse.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
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
-
isFailed
public boolean isFailed()Is this a failed execution of an operation. -
getFailureMessage
public java.lang.String getFailureMessage()The failure message,nullif it did not fail. -
getFailure
The actual failure object if there was a failure. -
writeTo
Description copied from interface:WriteableWrite this into the StreamOutput.
-