Skip to content

Commit

Permalink
Add found field for bulk deletes. Closes #3320
Browse files Browse the repository at this point in the history
  • Loading branch information
Paikan authored and martijnvg committed Jul 15, 2013
1 parent 470b685 commit b116097
Showing 1 changed file with 5 additions and 0 deletions.
Expand Up @@ -25,6 +25,7 @@
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;
Expand Down Expand Up @@ -125,6 +126,9 @@ public void onResponse(BulkResponse response) {
}
builder.endArray();
}
} else if (itemResponse.getResponse() instanceof DeleteResponse) {
DeleteResponse deleteResponse = itemResponse.getResponse();
builder.field(Fields.FOUND, !deleteResponse.isNotFound());
}
builder.endObject();
builder.endObject();
Expand Down Expand Up @@ -159,6 +163,7 @@ static final class Fields {
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");
}

}

0 comments on commit b116097

Please sign in to comment.