Package org.elasticsearch.action.bulk
Class BulkResponse
- java.lang.Object
-
- org.elasticsearch.transport.TransportMessage
-
- org.elasticsearch.transport.TransportResponse
-
- org.elasticsearch.action.ActionResponse
-
- org.elasticsearch.action.bulk.BulkResponse
-
- All Implemented Interfaces:
java.lang.Iterable<BulkItemResponse>
,Streamable
,Writeable
,StatusToXContentObject
,ToXContent
,ToXContentObject
public class BulkResponse extends ActionResponse implements java.lang.Iterable<BulkItemResponse>, StatusToXContentObject
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).
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from class org.elasticsearch.transport.TransportResponse
TransportResponse.Empty
-
Nested classes/interfaces inherited from interface org.elasticsearch.common.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 Modifier and Type Field Description static long
NO_INGEST_TOOK
-
Fields inherited from interface org.elasticsearch.common.xcontent.ToXContent
EMPTY_PARAMS
-
-
Constructor Summary
Constructors Constructor Description BulkResponse(BulkItemResponse[] responses, long tookInMillis)
BulkResponse(BulkItemResponse[] responses, long tookInMillis, long ingestTookInMillis)
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description java.lang.String
buildFailureMessage()
static BulkResponse
fromXContent(XContentParser parser)
TimeValue
getIngestTook()
If ingest is enabled returns the bulk ingest preprocessing time, otherwise 0 is returned.long
getIngestTookInMillis()
If ingest is enabled returns the bulk ingest preprocessing time.BulkItemResponse[]
getItems()
The items representing each action performed in the bulk operation (in the same order!).TimeValue
getTook()
How long the bulk execution took.boolean
hasFailures()
Has anything failed with the execution.java.util.Iterator<BulkItemResponse>
iterator()
void
readFrom(StreamInput in)
Set this object's fields from a StreamInput.RestStatus
status()
Returns the REST status to make sure it is returned correctlyXContentBuilder
toXContent(XContentBuilder builder, ToXContent.Params params)
void
writeTo(StreamOutput out)
Write this object's fields to a StreamOutput.-
Methods inherited from class org.elasticsearch.transport.TransportMessage
remoteAddress, remoteAddress
-
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
-
-
-
-
Field Detail
-
NO_INGEST_TOOK
public static final long NO_INGEST_TOOK
- See Also:
- Constant Field Values
-
-
Constructor Detail
-
BulkResponse
public BulkResponse(BulkItemResponse[] responses, long tookInMillis)
-
BulkResponse
public BulkResponse(BulkItemResponse[] responses, long tookInMillis, long ingestTookInMillis)
-
-
Method Detail
-
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 java.lang.String buildFailureMessage()
-
getItems
public BulkItemResponse[] getItems()
The items representing each action performed in the bulk operation (in the same order!).
-
iterator
public java.util.Iterator<BulkItemResponse> iterator()
- Specified by:
iterator
in interfacejava.lang.Iterable<BulkItemResponse>
-
readFrom
public void readFrom(StreamInput in) throws java.io.IOException
Description copied from interface:Streamable
Set this object's fields from a StreamInput.- Specified by:
readFrom
in interfaceStreamable
- Overrides:
readFrom
in classActionResponse
- Throws:
java.io.IOException
-
writeTo
public void writeTo(StreamOutput out) throws java.io.IOException
Description copied from interface:Streamable
Write this object's fields to a StreamOutput.- Specified by:
writeTo
in interfaceStreamable
- Specified by:
writeTo
in interfaceWriteable
- Overrides:
writeTo
in classActionResponse
- Throws:
java.io.IOException
-
status
public RestStatus 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 java.io.IOException
- Specified by:
toXContent
in interfaceToXContent
- Throws:
java.io.IOException
-
fromXContent
public static BulkResponse fromXContent(XContentParser parser) throws java.io.IOException
- Throws:
java.io.IOException
-
-