当前位置: 首页>>代码示例>>Java>>正文


Java IndexDeleteByQueryResponse类代码示例

本文整理汇总了Java中org.elasticsearch.action.deletebyquery.IndexDeleteByQueryResponse的典型用法代码示例。如果您正苦于以下问题:Java IndexDeleteByQueryResponse类的具体用法?Java IndexDeleteByQueryResponse怎么用?Java IndexDeleteByQueryResponse使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


IndexDeleteByQueryResponse类属于org.elasticsearch.action.deletebyquery包,在下文中一共展示了IndexDeleteByQueryResponse类的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: buildDelete

import org.elasticsearch.action.deletebyquery.IndexDeleteByQueryResponse; //导入依赖的package包/类
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();
}
 
开发者ID:huangchen007,项目名称:elasticsearch-rest-command,代码行数:24,代码来源:Search.java

示例2: toXContent

import org.elasticsearch.action.deletebyquery.IndexDeleteByQueryResponse; //导入依赖的package包/类
@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;
}
 
开发者ID:javanna,项目名称:elasticshell,代码行数:18,代码来源:DeleteByQueryRequestBuilder.java

示例3: buildResponse

import org.elasticsearch.action.deletebyquery.IndexDeleteByQueryResponse; //导入依赖的package包/类
@Override
public RestResponse buildResponse(DeleteByQueryResponse result, XContentBuilder builder) throws Exception {
	RestStatus restStatus = result.status();
	builder.startObject();
	builder.startObject(Fields._INDICES);
	for (IndexDeleteByQueryResponse indexDeleteByQueryResponse : result.getIndices().values()) {
		builder.startObject(indexDeleteByQueryResponse.getIndex(), XContentBuilder.FieldCaseConversion.NONE);

		builder.startObject(Fields._SHARDS);
		builder.field(Fields.TOTAL, indexDeleteByQueryResponse.getTotalShards());
		builder.field(Fields.SUCCESSFUL, indexDeleteByQueryResponse.getSuccessfulShards());
		builder.field(Fields.FAILED, indexDeleteByQueryResponse.getFailedShards());
		ShardOperationFailedException[] failures = indexDeleteByQueryResponse.getFailures();
		if (failures != null && failures.length > 0) {
			builder.startArray(Fields.FAILURES);
			for (ShardOperationFailedException shardFailure : failures) {
				builder.startObject();
				builder.field(Fields.INDEX, shardFailure.index());
				builder.field(Fields.SHARD, shardFailure.shardId());
				builder.field(Fields.REASON, shardFailure.reason());
				builder.endObject();
			}
			builder.endArray();
		}
		builder.endObject();

		builder.endObject();
	}
	builder.endObject();
	builder.endObject();
	return new BytesRestResponse(restStatus, builder);
}
 
开发者ID:lane-cn,项目名称:elasticsql,代码行数:33,代码来源:DeleteByQueryRestListener.java

示例4: checkForFailures

import org.elasticsearch.action.deletebyquery.IndexDeleteByQueryResponse; //导入依赖的package包/类
private void checkForFailures(String name, DeleteByQueryResponse actionGet) {
    for (IndexDeleteByQueryResponse r : actionGet) {
        if (r.getFailedShards() > 0) {
            LOG.error("SuccessfulShards {} / {} for {}",
                    r.getSuccessfulShards(), r.getTotalShards(), name);
        }
    }
}
 
开发者ID:raymyers,项目名称:dev-search,代码行数:9,代码来源:LocalRepoCrawler.java

示例5: checkDeleteByQueryResponse

import org.elasticsearch.action.deletebyquery.IndexDeleteByQueryResponse; //导入依赖的package包/类
/**
 * 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() );
        }
    }
}
 
开发者ID:apache,项目名称:usergrid,代码行数:17,代码来源:EsEntityIndexImpl.java

示例6: truncateIndex

import org.elasticsearch.action.deletebyquery.IndexDeleteByQueryResponse; //导入依赖的package包/类
public IndexDeleteByQueryResponse truncateIndex() throws InterruptedException, ExecutionException {
    try (Client client = getClient()) {
        QueryBuilder queryBuilder = new MatchAllQueryBuilder();
        ListenableActionFuture<DeleteByQueryResponse> response = client.prepareDeleteByQuery(INDEX_NAME)
                .setTypes(DOCUMENT_TYPE).setQuery(queryBuilder).execute();
        DeleteByQueryResponse deleteByQueryResponse = response.get();
        IndexDeleteByQueryResponse indexResult = deleteByQueryResponse.getIndex(INDEX_NAME);
        return indexResult;
    }
}
 
开发者ID:datacleaner,项目名称:extension_elasticsearch,代码行数:11,代码来源:ElasticSearchTestServer.java


注:本文中的org.elasticsearch.action.deletebyquery.IndexDeleteByQueryResponse类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。