org.elasticsearch.action.deletebyquery.IndexDeleteByQueryResponse Java Examples
The following examples show how to use
org.elasticsearch.action.deletebyquery.IndexDeleteByQueryResponse.
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: Search.java From elasticsearch-rest-command with The Unlicense | 6 votes |
public void buildDelete(XContentBuilder builder, DeleteByQueryResponse response) throws IOException { builder.startObject(); builder.startObject("_indices"); for (IndexDeleteByQueryResponse indexDeleteByQueryResponse : response .getIndices().values()) { builder.startObject(indexDeleteByQueryResponse.getIndex(), XContentBuilder.FieldCaseConversion.NONE); builder.startObject("_shards"); builder.field("total", indexDeleteByQueryResponse.getTotalShards()); builder.field("successful", indexDeleteByQueryResponse.getSuccessfulShards()); builder.field("failed", indexDeleteByQueryResponse.getFailedShards()); builder.endObject(); builder.endObject(); } builder.endObject(); builder.endObject(); }
Example #2
Source File: DeleteByQueryRequestBuilder.java From elasticshell with Apache License 2.0 | 6 votes |
@Override protected XContentBuilder toXContent(DeleteByQueryRequest request, DeleteByQueryResponse response, XContentBuilder builder) throws IOException { builder.startObject().field(Fields.OK, true); builder.startObject("_indices"); for (IndexDeleteByQueryResponse indexDeleteByQueryResponse : response.getIndices().values()) { builder.startObject(indexDeleteByQueryResponse.getIndex(), XContentBuilder.FieldCaseConversion.NONE); builder.startObject("_shards"); builder.field("total", indexDeleteByQueryResponse.getTotalShards()); builder.field("successful", indexDeleteByQueryResponse.getSuccessfulShards()); builder.field("failed", indexDeleteByQueryResponse.getFailedShards()); builder.endObject(); builder.endObject(); } builder.endObject(); builder.endObject(); return builder; }
Example #3
Source File: EsEntityIndexImpl.java From usergrid with Apache License 2.0 | 5 votes |
/** * Validate the response doesn't contain errors, if it does, fail fast at the first error we encounter */ private void checkDeleteByQueryResponse( final QueryBuilder query, final DeleteByQueryResponse response ) { for ( IndexDeleteByQueryResponse indexDeleteByQueryResponse : response ) { final ShardOperationFailedException[] failures = indexDeleteByQueryResponse.getFailures(); for ( ShardOperationFailedException failedException : failures ) { logger.error("Unable to delete by query {}. Failed with code {} and reason {} on shard {} in index {}", query.toString(), failedException.status().getStatus(), failedException.reason(), failedException.shardId(), failedException.index() ); } } }