當前位置: 首頁>>代碼示例>>Java>>正文


Java ElasticsearchException.generateThrowableXContent方法代碼示例

本文整理匯總了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;
}
 
開發者ID:justor,項目名稱:elasticsearch_my,代碼行數:22,代碼來源:ScrollableHitSource.java

示例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;
}
 
開發者ID:justor,項目名稱:elasticsearch_my,代碼行數:21,代碼來源:BulkItemResponse.java

示例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();
    }
}
 
開發者ID:justor,項目名稱:elasticsearch_my,代碼行數:9,代碼來源:TaskResult.java

示例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;
}
 
開發者ID:justor,項目名稱:elasticsearch_my,代碼行數:33,代碼來源:NodeAllocationResult.java

示例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;
}
 
開發者ID:justor,項目名稱:elasticsearch_my,代碼行數:15,代碼來源:IndicesShardStoresResponse.java

示例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;
}
 
開發者ID:justor,項目名稱:elasticsearch_my,代碼行數:16,代碼來源:ShardSearchFailure.java

示例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;

}
 
開發者ID:justor,項目名稱:elasticsearch_my,代碼行數:15,代碼來源:TaskOperationFailure.java

示例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;
}
 
開發者ID:justor,項目名稱:elasticsearch_my,代碼行數:16,代碼來源:ReplicationResponse.java

示例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;

}
 
開發者ID:justor,項目名稱:elasticsearch_my,代碼行數:15,代碼來源:DefaultShardOperationFailedException.java

示例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;
}
 
開發者ID:justor,項目名稱:elasticsearch_my,代碼行數:12,代碼來源:BulkByScrollTask.java


注:本文中的org.elasticsearch.ElasticsearchException.generateThrowableXContent方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。