本文整理汇总了Java中org.elasticsearch.ElasticSearchException.generateThrowableXContent方法的典型用法代码示例。如果您正苦于以下问题:Java ElasticSearchException.generateThrowableXContent方法的具体用法?Java ElasticSearchException.generateThrowableXContent怎么用?Java ElasticSearchException.generateThrowableXContent使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.elasticsearch.ElasticSearchException
的用法示例。
在下文中一共展示了ElasticSearchException.generateThrowableXContent方法的10个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: toXContent
import org.elasticsearch.ElasticSearchException; //导入方法依赖的package包/类
@Override
public XContentBuilder toXContent(XContentBuilder builder, Params params) throws IOException {
builder.startObject();
if (index != null) {
builder.field("index", index);
}
if (shardId != null) {
builder.field("shard", shardId);
}
if (nodeId != null) {
builder.field("node", nodeId);
}
builder.field("reason");
{
builder.startObject();
ElasticsearchException.generateThrowableXContent(builder, params, reason);
builder.endObject();
}
builder.endObject();
return builder;
}
示例2: toXContent
import org.elasticsearch.ElasticSearchException; //导入方法依赖的package包/类
@Override
public XContentBuilder toXContent(XContentBuilder builder, Params params) throws IOException {
builder.startObject();
builder.startObject(opType.getLowercase());
if (failure == null) {
response.innerToXContent(builder, params);
builder.field(STATUS, response.status().getStatus());
} else {
builder.field(_INDEX, failure.getIndex());
builder.field(_TYPE, failure.getType());
builder.field(_ID, failure.getId());
builder.field(STATUS, failure.getStatus().getStatus());
builder.startObject(ERROR);
ElasticsearchException.generateThrowableXContent(builder, params, failure.getCause());
builder.endObject();
}
builder.endObject();
builder.endObject();
return builder;
}
示例3: toXContent
import org.elasticsearch.ElasticSearchException; //导入方法依赖的package包/类
private static BytesReference toXContent(Exception error) throws IOException {
try (XContentBuilder builder = XContentFactory.contentBuilder(Requests.INDEX_CONTENT_TYPE)) {
builder.startObject();
ElasticsearchException.generateThrowableXContent(builder, ToXContent.EMPTY_PARAMS, error);
builder.endObject();
return builder.bytes();
}
}
示例4: toXContent
import org.elasticsearch.ElasticSearchException; //导入方法依赖的package包/类
@Override
public XContentBuilder toXContent(XContentBuilder builder, Params params) throws IOException {
builder.startObject("store");
{
if (matchingBytes < 0) {
// dealing with a primary shard
if (allocationId == null && storeException == null) {
// there was no information we could obtain of any shard data on the node
builder.field("found", false);
} else {
builder.field("in_sync", inSync);
}
}
if (allocationId != null) {
builder.field("allocation_id", allocationId);
}
if (matchingBytes >= 0) {
if (hasMatchingSyncId()) {
builder.field("matching_sync_id", true);
} else {
builder.byteSizeField("matching_size_in_bytes", "matching_size", matchingBytes);
}
}
if (storeException != null) {
builder.startObject("store_exception");
ElasticsearchException.generateThrowableXContent(builder, params, storeException);
builder.endObject();
}
}
builder.endObject();
return builder;
}
示例5: toXContent
import org.elasticsearch.ElasticSearchException; //导入方法依赖的package包/类
@Override
public XContentBuilder toXContent(XContentBuilder builder, Params params) throws IOException {
node.toXContent(builder, params);
if (allocationId != null) {
builder.field(Fields.ALLOCATION_ID, allocationId);
}
builder.field(Fields.ALLOCATED, allocationStatus.value());
if (storeException != null) {
builder.startObject(Fields.STORE_EXCEPTION);
ElasticsearchException.generateThrowableXContent(builder, params, storeException);
builder.endObject();
}
return builder;
}
示例6: toXContent
import org.elasticsearch.ElasticSearchException; //导入方法依赖的package包/类
@Override
public XContentBuilder toXContent(XContentBuilder builder, Params params) throws IOException {
builder.field(SHARD_FIELD, shardId());
builder.field(INDEX_FIELD, index());
if (shardTarget != null) {
builder.field(NODE_FIELD, shardTarget.getNodeId());
}
if (cause != null) {
builder.field(REASON_FIELD);
builder.startObject();
ElasticsearchException.generateThrowableXContent(builder, params, cause);
builder.endObject();
}
return builder;
}
示例7: toXContent
import org.elasticsearch.ElasticSearchException; //导入方法依赖的package包/类
@Override
public XContentBuilder toXContent(XContentBuilder builder, Params params) throws IOException {
builder.field("task_id", getTaskId());
builder.field("node_id", getNodeId());
builder.field("status", status.name());
if (reason != null) {
builder.field("reason");
builder.startObject();
ElasticsearchException.generateThrowableXContent(builder, params, reason);
builder.endObject();
}
return builder;
}
示例8: toXContent
import org.elasticsearch.ElasticSearchException; //导入方法依赖的package包/类
@Override
public XContentBuilder toXContent(XContentBuilder builder, Params params) throws IOException {
builder.startObject();
builder.field(_INDEX, shardId.getIndexName());
builder.field(_SHARD, shardId.id());
builder.field(_NODE, nodeId);
builder.field(REASON);
builder.startObject();
ElasticsearchException.generateThrowableXContent(builder, params, cause);
builder.endObject();
builder.field(STATUS, status);
builder.field(PRIMARY, primary);
builder.endObject();
return builder;
}
示例9: toXContent
import org.elasticsearch.ElasticSearchException; //导入方法依赖的package包/类
@Override
public XContentBuilder toXContent(XContentBuilder builder, Params params) throws IOException {
builder.field("shard", shardId());
builder.field("index", index());
builder.field("status", status.name());
if (reason != null) {
builder.field("reason");
builder.startObject();
ElasticsearchException.generateThrowableXContent(builder, params, reason);
builder.endObject();
}
return builder;
}
示例10: toXContent
import org.elasticsearch.ElasticSearchException; //导入方法依赖的package包/类
@Override
public XContentBuilder toXContent(XContentBuilder builder, Params params) throws IOException {
if (exception == null) {
status.toXContent(builder, params);
} else {
builder.startObject();
ElasticsearchException.generateThrowableXContent(builder, params, exception);
builder.endObject();
}
return builder;
}