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


Java ExceptionsHelper.groupBy方法代码示例

本文整理汇总了Java中org.elasticsearch.ExceptionsHelper.groupBy方法的典型用法代码示例。如果您正苦于以下问题:Java ExceptionsHelper.groupBy方法的具体用法?Java ExceptionsHelper.groupBy怎么用?Java ExceptionsHelper.groupBy使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在org.elasticsearch.ExceptionsHelper的用法示例。


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

示例1: buildBroadcastShardsHeader

import org.elasticsearch.ExceptionsHelper; //导入方法依赖的package包/类
public static void buildBroadcastShardsHeader(XContentBuilder builder, Params params,
                                              int total, int successful, int failed,
                                              ShardOperationFailedException[] shardFailures) throws IOException {
    builder.startObject("_shards");
    builder.field("total", total);
    builder.field("successful", successful);
    builder.field("failed", failed);
    if (shardFailures != null && shardFailures.length > 0) {
        builder.startArray("failures");
        final boolean group = params.paramAsBoolean("group_shard_failures", true); // we group by default
        for (ShardOperationFailedException shardFailure : group ? ExceptionsHelper.groupBy(shardFailures) : shardFailures) {
            builder.startObject();
            shardFailure.toXContent(builder, params);
            builder.endObject();
        }
        builder.endArray();
    }
    builder.endObject();
}
 
开发者ID:justor,项目名称:elasticsearch_my,代码行数:20,代码来源:RestActions.java

示例2: executeNextPhase

import org.elasticsearch.ExceptionsHelper; //导入方法依赖的package包/类
@Override
public final void executeNextPhase(SearchPhase currentPhase, SearchPhase nextPhase) {
    /* This is the main search phase transition where we move to the next phase. At this point we check if there is
     * at least one successful operation left and if so we move to the next phase. If not we immediately fail the
     * search phase as "all shards failed"*/
    if (successfulOps.get() == 0) { // we have 0 successful results that means we shortcut stuff and return a failure
        if (logger.isDebugEnabled()) {
            final ShardOperationFailedException[] shardSearchFailures = ExceptionsHelper.groupBy(buildShardFailures());
            Throwable cause = ElasticsearchException.guessRootCauses(shardSearchFailures[0].getCause())[0];
            logger.debug((Supplier<?>) () -> new ParameterizedMessage("All shards failed for phase: [{}]", getName()),
                cause);
        }
        onPhaseFailure(currentPhase, "all shards failed", null);
    } else {
        if (logger.isTraceEnabled()) {
            final String resultsFrom = results.getSuccessfulResults()
                .map(r -> r.shardTarget().toString()).collect(Collectors.joining(","));
            logger.trace("[{}] Moving to next phase: [{}], based on results from: {} (cluster state version: {})",
                currentPhase.getName(), nextPhase.getName(), resultsFrom, clusterStateVersion);
        }
        executePhase(nextPhase);
    }
}
 
开发者ID:justor,项目名称:elasticsearch_my,代码行数:24,代码来源:AbstractSearchAsyncAction.java

示例3: metadataToXContent

import org.elasticsearch.ExceptionsHelper; //导入方法依赖的package包/类
@Override
protected void metadataToXContent(XContentBuilder builder, Params params) throws IOException {
    builder.field("phase", phaseName);
    final boolean group = params.paramAsBoolean("group_shard_failures", true); // we group by default
    builder.field("grouped", group); // notify that it's grouped
    builder.field("failed_shards");
    builder.startArray();
    ShardOperationFailedException[] failures = params.paramAsBoolean("group_shard_failures", true) ?
            ExceptionsHelper.groupBy(shardFailures) : shardFailures;
    for (ShardOperationFailedException failure : failures) {
        builder.startObject();
        failure.toXContent(builder, params);
        builder.endObject();
    }
    builder.endArray();
}
 
开发者ID:justor,项目名称:elasticsearch_my,代码行数:17,代码来源:SearchPhaseExecutionException.java

示例4: buildBroadcastShardsHeader

import org.elasticsearch.ExceptionsHelper; //导入方法依赖的package包/类
public static void buildBroadcastShardsHeader(XContentBuilder builder, ToXContent.Params params, int total, int successful, int failed, ShardOperationFailedException[] shardFailures) throws IOException {
    builder.startObject(Fields._SHARDS);
    builder.field(Fields.TOTAL, total);
    builder.field(Fields.SUCCESSFUL, successful);
    builder.field(Fields.FAILED, failed);
    if (shardFailures != null && shardFailures.length > 0) {
        builder.startArray(Fields.FAILURES);
        final boolean group = params.paramAsBoolean("group_shard_failures", true); // we group by default
        for (ShardOperationFailedException shardFailure : group ? ExceptionsHelper.groupBy(shardFailures) : shardFailures) {
            builder.startObject();
            shardFailure.toXContent(builder, params);
            builder.endObject();
        }
        builder.endArray();
    }
    builder.endObject();
}
 
开发者ID:baidu,项目名称:Elasticsearch,代码行数:18,代码来源:RestActions.java

示例5: innerToXContent

import org.elasticsearch.ExceptionsHelper; //导入方法依赖的package包/类
@Override
protected void innerToXContent(XContentBuilder builder, Params params) throws IOException {
    builder.field("phase", phaseName);
    final boolean group = params.paramAsBoolean("group_shard_failures", true); // we group by default
    builder.field("grouped", group); // notify that it's grouped
    builder.field("failed_shards");
    builder.startArray();
    ShardOperationFailedException[] failures = params.paramAsBoolean("group_shard_failures", true) ? ExceptionsHelper.groupBy(shardFailures) : shardFailures;
    for (ShardOperationFailedException failure : failures) {
        builder.startObject();
        failure.toXContent(builder, params);
        builder.endObject();
    }
    builder.endArray();
    super.innerToXContent(builder, params);
}
 
开发者ID:baidu,项目名称:Elasticsearch,代码行数:17,代码来源:SearchPhaseExecutionException.java


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