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


Java ShardOperationFailedException.toXContent方法代码示例

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


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

示例1: buildBroadcastShardsHeader

import org.elasticsearch.action.ShardOperationFailedException; //导入方法依赖的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: metadataToXContent

import org.elasticsearch.action.ShardOperationFailedException; //导入方法依赖的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

示例3: buildBroadcastShardsHeader

import org.elasticsearch.action.ShardOperationFailedException; //导入方法依赖的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

示例4: innerToXContent

import org.elasticsearch.action.ShardOperationFailedException; //导入方法依赖的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

示例5: toXContent

import org.elasticsearch.action.ShardOperationFailedException; //导入方法依赖的package包/类
@Override
public XContentBuilder toXContent(XContentBuilder builder, Params params) throws IOException {
    if (failures.size() > 0) {
        builder.startArray(Fields.FAILURES);
        for (ShardOperationFailedException failure : failures) {
            builder.startObject();
            failure.toXContent(builder, params);
            builder.endObject();
        }
        builder.endArray();
    }

    builder.startObject(Fields.INDICES);
    for (ObjectObjectCursor<String, ImmutableOpenIntMap<List<StoreStatus>>> indexShards : storeStatuses) {
        builder.startObject(indexShards.key);

        builder.startObject(Fields.SHARDS);
        for (IntObjectCursor<List<StoreStatus>> shardStatusesEntry : indexShards.value) {
            builder.startObject(String.valueOf(shardStatusesEntry.key));
            builder.startArray(Fields.STORES);
            for (StoreStatus storeStatus : shardStatusesEntry.value) {
                builder.startObject();
                storeStatus.toXContent(builder, params);
                builder.endObject();
            }
            builder.endArray();

            builder.endObject();
        }
        builder.endObject();

        builder.endObject();
    }
    builder.endObject();
    return builder;
}
 
开发者ID:justor,项目名称:elasticsearch_my,代码行数:37,代码来源:IndicesShardStoresResponse.java


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