From 201dc87aae5dcc4bbaf092c0033424b8bec15b37 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Christoph=20B=C3=BCscher?= Date: Mon, 6 Jul 2015 20:07:26 +0200 Subject: [PATCH] Fix: Use correct OpType on Failure in BulkItemResponse When a bulk request fails on a Delete or Update request, the BulkItemResponse reports incorrect "index" operation in the response. This PR fixes this for the case of closed indices as reported in #9821 but also for other failures and adds tests for the two cases covered. Closes #9821 --- .../action/bulk/BulkItemResponse.java | 2 -- .../action/bulk/TransportBulkAction.java | 14 ++++++-- .../org/elasticsearch/document/BulkTests.java | 34 +++++++++++++++++++ 3 files changed, 45 insertions(+), 5 deletions(-) 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 3b9d2e03ba0..80e86eaaf17 100644 --- a/core/src/main/java/org/elasticsearch/action/bulk/BulkItemResponse.java +++ b/core/src/main/java/org/elasticsearch/action/bulk/BulkItemResponse.java @@ -19,7 +19,6 @@ package org.elasticsearch.action.bulk; -import org.elasticsearch.ElasticsearchException; import org.elasticsearch.ExceptionsHelper; import org.elasticsearch.action.ActionWriteResponse; import org.elasticsearch.action.delete.DeleteResponse; @@ -28,7 +27,6 @@ import org.elasticsearch.action.update.UpdateResponse; import org.elasticsearch.common.io.stream.StreamInput; import org.elasticsearch.common.io.stream.StreamOutput; import org.elasticsearch.common.io.stream.Streamable; -import org.elasticsearch.common.xcontent.XContentBuilder; import org.elasticsearch.rest.RestStatus; import java.io.IOException; diff --git a/core/src/main/java/org/elasticsearch/action/bulk/TransportBulkAction.java b/core/src/main/java/org/elasticsearch/action/bulk/TransportBulkAction.java index e97af0f3da3..783db0c33db 100644 --- a/core/src/main/java/org/elasticsearch/action/bulk/TransportBulkAction.java +++ b/core/src/main/java/org/elasticsearch/action/bulk/TransportBulkAction.java @@ -168,13 +168,13 @@ public class TransportBulkAction extends HandledTransportAction