Package org.elasticsearch.action.bulk
Class BulkItemResponse
java.lang.Object
org.elasticsearch.action.bulk.BulkItemResponse
- All Implemented Interfaces:
Writeable
,StatusToXContentObject
,ToXContent
,ToXContentObject
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/interfaces inherited from interface org.elasticsearch.xcontent.ToXContent
ToXContent.DelegatingMapParams, ToXContent.MapParams, 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.xcontent.ToXContent
EMPTY_PARAMS
-
Method Summary
Modifier and TypeMethodDescriptionstatic BulkItemResponse
failure
(int id, DocWriteRequest.OpType opType, BulkItemResponse.Failure failure) static BulkItemResponse
fromXContent
(XContentParser parser, int id) Reads aBulkItemResponse
from aXContentParser
.The actual failure object if there was a failure.The failure message,null
if it did not fail.getId()
The id of the action.getIndex()
The index name of the action.int
The numeric order of the item matching the same request order in the bulk request.The operation type ("index", "create" or "delete").<T extends DocWriteResponse>
TThe actual response (IndexResponse
orDeleteResponse
).getType()
The type of the action.long
The version of the action.boolean
isFailed()
Is this a failed execution of an operation.status()
Returns the REST status to make sure it is returned correctlystatic BulkItemResponse
success
(int id, DocWriteRequest.OpType opType, DocWriteResponse response) toXContent
(XContentBuilder builder, 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.xcontent.ToXContentObject
isFragment
-
Method Details
-
status
Description copied from interface:StatusToXContentObject
Returns the REST status to make sure it is returned correctly- Specified by:
status
in interfaceStatusToXContentObject
-
toXContent
public XContentBuilder toXContent(XContentBuilder builder, ToXContent.Params params) throws IOException - Specified by:
toXContent
in interfaceToXContent
- Throws:
IOException
-
fromXContent
Reads aBulkItemResponse
from aXContentParser
.- Parameters:
parser
- theXContentParser
id
- the id to assign to the parsedBulkItemResponse
. It is usually the index of the item in theBulkResponse.getItems()
array.- Throws:
IOException
-
success
public static BulkItemResponse success(int id, DocWriteRequest.OpType opType, DocWriteResponse response) -
failure
public static BulkItemResponse failure(int id, DocWriteRequest.OpType opType, BulkItemResponse.Failure failure) -
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
The index name of the action. -
getType
The type of the action. -
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
The failure message,null
if it did not fail. -
getFailure
The actual failure object if there was a failure. -
writeTo
Description copied from interface:Writeable
Write this into the StreamOutput.- Specified by:
writeTo
in interfaceWriteable
- Throws:
IOException
-
writeThin
- Throws:
IOException
-