• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

Java IndexDeleteByQueryResponse类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了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;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
Java ASMStackMapAttribute类代码示例发布时间:2022-05-22
下一篇:
Java CatchHandlerList类代码示例发布时间:2022-05-22
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap