From b116097ea5d28ed73674a219067e7601e2677944 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Benjamin=20Dev=C3=A8ze?= Date: Sun, 14 Jul 2013 15:01:12 +0200 Subject: [PATCH] Add found field for bulk deletes. Closes #3320 --- .../org/elasticsearch/rest/action/bulk/RestBulkAction.java | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/src/main/java/org/elasticsearch/rest/action/bulk/RestBulkAction.java b/src/main/java/org/elasticsearch/rest/action/bulk/RestBulkAction.java index 76b2e1ab33a..81703830426 100644 --- a/src/main/java/org/elasticsearch/rest/action/bulk/RestBulkAction.java +++ b/src/main/java/org/elasticsearch/rest/action/bulk/RestBulkAction.java @@ -25,6 +25,7 @@ import org.elasticsearch.action.bulk.BulkItemResponse; import org.elasticsearch.action.bulk.BulkRequest; import org.elasticsearch.action.bulk.BulkResponse; import org.elasticsearch.action.index.IndexResponse; +import org.elasticsearch.action.delete.DeleteResponse; import org.elasticsearch.action.support.replication.ReplicationType; import org.elasticsearch.client.Client; import org.elasticsearch.client.Requests; @@ -125,6 +126,9 @@ public class RestBulkAction extends BaseRestHandler { } builder.endArray(); } + } else if (itemResponse.getResponse() instanceof DeleteResponse) { + DeleteResponse deleteResponse = itemResponse.getResponse(); + builder.field(Fields.FOUND, !deleteResponse.isNotFound()); } builder.endObject(); builder.endObject(); @@ -159,6 +163,7 @@ public class RestBulkAction extends BaseRestHandler { static final XContentBuilderString TOOK = new XContentBuilderString("took"); static final XContentBuilderString _VERSION = new XContentBuilderString("_version"); static final XContentBuilderString MATCHES = new XContentBuilderString("matches"); + static final XContentBuilderString FOUND = new XContentBuilderString("found"); } }