diff --git a/core/src/main/java/org/elasticsearch/action/bulk/BulkItemResponse.java b/core/src/main/java/org/elasticsearch/action/bulk/BulkItemResponse.java index 13d4201e6cf..1062b397af5 100644 --- a/core/src/main/java/org/elasticsearch/action/bulk/BulkItemResponse.java +++ b/core/src/main/java/org/elasticsearch/action/bulk/BulkItemResponse.java @@ -25,6 +25,7 @@ import org.elasticsearch.action.DocWriteResponse; import org.elasticsearch.action.delete.DeleteResponse; import org.elasticsearch.action.index.IndexResponse; import org.elasticsearch.action.update.UpdateResponse; +import org.elasticsearch.common.Strings; import org.elasticsearch.common.io.stream.StreamInput; import org.elasticsearch.common.io.stream.StreamOutput; import org.elasticsearch.common.io.stream.Streamable; @@ -173,6 +174,11 @@ public class BulkItemResponse implements Streamable, StatusToXContent { builder.field(STATUS_FIELD, status.getStatus()); return builder; } + + @Override + public String toString() { + return Strings.toString(this); + } } private int id; diff --git a/core/src/test/java/org/elasticsearch/ingest/IngestClientIT.java b/core/src/test/java/org/elasticsearch/ingest/IngestClientIT.java index f0d12158752..2945a6ce269 100644 --- a/core/src/test/java/org/elasticsearch/ingest/IngestClientIT.java +++ b/core/src/test/java/org/elasticsearch/ingest/IngestClientIT.java @@ -158,6 +158,9 @@ public class IngestClientIT extends ESIntegTestCase { assertThat(failure.getMessage(), equalTo("java.lang.IllegalArgumentException: test processor failed")); } else { IndexResponse indexResponse = itemResponse.getResponse(); + assertThat("Expected a successful response but found failure [" + itemResponse.getFailure() + "].", + itemResponse.isFailed(), is(false)); + assertThat(indexResponse, notNullValue()); assertThat(indexResponse.getId(), equalTo(Integer.toString(i))); assertThat(indexResponse.isCreated(), is(true)); }