當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。