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


Java ElasticSearchException.generateFailureXContent方法代码示例

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


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

示例1: toXContent

import org.elasticsearch.ElasticSearchException; //导入方法依赖的package包/类
@Override
public XContentBuilder toXContent(XContentBuilder builder, ToXContent.Params params) throws IOException {
    builder.startObject();
    builder.startArray(Fields.RESPONSES);
    for (Item item : items) {
        if (item.isFailure()) {
            builder.startObject();
            ElasticsearchException.generateFailureXContent(builder, params, item.getFailure(), true);
            builder.endObject();
        } else {
            item.getResponse().toXContent(builder, params);
        }
    }
    builder.endArray();
    builder.endObject();
    return builder;
}
 
开发者ID:justor,项目名称:elasticsearch_my,代码行数:18,代码来源:MultiSearchTemplateResponse.java

示例2: build

import org.elasticsearch.ElasticSearchException; //导入方法依赖的package包/类
private static XContentBuilder build(RestChannel channel, RestStatus status, Exception e) throws IOException {
    ToXContent.Params params = channel.request();
    if (params.paramAsBoolean("error_trace", !REST_EXCEPTION_SKIP_STACK_TRACE_DEFAULT)) {
        params =  new ToXContent.DelegatingMapParams(singletonMap(REST_EXCEPTION_SKIP_STACK_TRACE, "false"), params);
    } else if (e != null) {
        Supplier<?> messageSupplier = () -> new ParameterizedMessage("path: {}, params: {}",
                channel.request().rawPath(), channel.request().params());

        if (status.getStatus() < 500) {
            SUPPRESSED_ERROR_LOGGER.debug(messageSupplier, e);
        } else {
            SUPPRESSED_ERROR_LOGGER.warn(messageSupplier, e);
        }
    }

    XContentBuilder builder = channel.newErrorBuilder().startObject();
    ElasticsearchException.generateFailureXContent(builder, params, e, channel.detailedErrorsEnabled());
    builder.field(STATUS, status.getStatus());
    builder.endObject();
    return builder;
}
 
开发者ID:justor,项目名称:elasticsearch_my,代码行数:22,代码来源:BytesRestResponse.java

示例3: toXContent

import org.elasticsearch.ElasticSearchException; //导入方法依赖的package包/类
@Override
public XContentBuilder toXContent(XContentBuilder builder, Params params) throws IOException {
    builder.startObject();
    builder.startArray(Fields.DOCS);
    for (MultiGetItemResponse response : responses) {
        if (response.isFailed()) {
            builder.startObject();
            Failure failure = response.getFailure();
            builder.field(Fields._INDEX, failure.getIndex());
            builder.field(Fields._TYPE, failure.getType());
            builder.field(Fields._ID, failure.getId());
            ElasticsearchException.generateFailureXContent(builder, params, failure.getFailure(), true);
            builder.endObject();
        } else {
            GetResponse getResponse = response.getResponse();
            getResponse.toXContent(builder, params);
        }
    }
    builder.endArray();
    builder.endObject();
    return builder;
}
 
开发者ID:justor,项目名称:elasticsearch_my,代码行数:23,代码来源:MultiGetResponse.java

示例4: toXContent

import org.elasticsearch.ElasticSearchException; //导入方法依赖的package包/类
@Override
public XContentBuilder toXContent(XContentBuilder builder, Params params) throws IOException {
    builder.startObject();
    builder.startArray(Fields.RESPONSES);
    for (Item item : items) {
        builder.startObject();
        if (item.isFailure()) {
            ElasticsearchException.generateFailureXContent(builder, params, item.getFailure(), true);
            builder.field(Fields.STATUS, ExceptionsHelper.status(item.getFailure()).getStatus());
        } else {
            item.getResponse().innerToXContent(builder, params);
            builder.field(Fields.STATUS, item.getResponse().status().getStatus());
        }
        builder.endObject();
    }
    builder.endArray();
    builder.endObject();
    return builder;
}
 
开发者ID:justor,项目名称:elasticsearch_my,代码行数:20,代码来源:MultiSearchResponse.java

示例5: toXContent

import org.elasticsearch.ElasticSearchException; //导入方法依赖的package包/类
@Override
public XContentBuilder toXContent(XContentBuilder builder, Params params) throws IOException {
    builder.startObject();

    if (processorTag != null) {
        builder.field(ConfigurationUtils.TAG_KEY, processorTag);
    }

    if (failure != null && ingestDocument != null) {
        builder.startObject("ignored_error");
        ElasticsearchException.generateFailureXContent(builder, params, failure, true);
        builder.endObject();
    } else if (failure != null) {
        ElasticsearchException.generateFailureXContent(builder, params, failure, true);
    }

    if (ingestDocument != null) {
        ingestDocument.toXContent(builder, params);
    }

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

示例6: toXContent

import org.elasticsearch.ElasticSearchException; //导入方法依赖的package包/类
@Override
public XContentBuilder toXContent(XContentBuilder builder, Params params) throws IOException {
    builder.startObject();
    builder.startArray(Fields.DOCS);
    for (MultiTermVectorsItemResponse response : responses) {
        if (response.isFailed()) {
            builder.startObject();
            Failure failure = response.getFailure();
            builder.field(Fields._INDEX, failure.getIndex());
            builder.field(Fields._TYPE, failure.getType());
            builder.field(Fields._ID, failure.getId());
            ElasticsearchException.generateFailureXContent(builder, params, failure.getCause(), true);
            builder.endObject();
        } else {
            TermVectorsResponse getResponse = response.getResponse();
            getResponse.toXContent(builder, params);
        }
    }
    builder.endArray();
    builder.endObject();
    return builder;
}
 
开发者ID:justor,项目名称:elasticsearch_my,代码行数:23,代码来源:MultiTermVectorsResponse.java

示例7: toXContent

import org.elasticsearch.ElasticSearchException; //导入方法依赖的package包/类
@Override
public XContentBuilder toXContent(XContentBuilder builder, Params params) throws IOException {
    builder.startObject();
    if (failure == null) {
        ingestDocument.toXContent(builder, params);
    } else {
        ElasticsearchException.generateFailureXContent(builder, params, failure, true);
    }
    builder.endObject();
    return builder;
}
 
开发者ID:justor,项目名称:elasticsearch_my,代码行数:12,代码来源:SimulateDocumentBaseResult.java


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