本文整理汇总了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;
}
示例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;
}
示例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;
}
示例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;
}
示例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;
}
示例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;
}
示例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;
}