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


Java XContentBuilder.dateValueField方法代碼示例

本文整理匯總了Java中org.elasticsearch.common.xcontent.XContentBuilder.dateValueField方法的典型用法代碼示例。如果您正苦於以下問題:Java XContentBuilder.dateValueField方法的具體用法?Java XContentBuilder.dateValueField怎麽用?Java XContentBuilder.dateValueField使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在org.elasticsearch.common.xcontent.XContentBuilder的用法示例。


在下文中一共展示了XContentBuilder.dateValueField方法的3個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: toXContent

import org.elasticsearch.common.xcontent.XContentBuilder; //導入方法依賴的package包/類
@Override
public XContentBuilder toXContent(XContentBuilder builder, Params params) throws IOException {
    builder.field("node", node.getId());
    builder.field("id", taskId.getId());
    builder.field("type", type);
    builder.field("action", action);
    if (status != null) {
        builder.field("status", status, params);
    }
    if (description != null) {
        builder.field("description", description);
    }
    builder.dateValueField("start_time_in_millis", "start_time", startTime);
    builder.timeValueField("running_time_in_nanos", "running_time", runningTimeNanos, TimeUnit.NANOSECONDS);
    if (parentTaskId.isSet()) {
        builder.field("parent_task_id", parentTaskId.toString());
    }
    return builder;
}
 
開發者ID:baidu,項目名稱:Elasticsearch,代碼行數:20,代碼來源:TaskInfo.java

示例2: toXContent

import org.elasticsearch.common.xcontent.XContentBuilder; //導入方法依賴的package包/類
@Override
public XContentBuilder toXContent(XContentBuilder builder, Params params) throws IOException {
    builder.startObject(Fields.JVM);
    builder.field(Fields.PID, pid);
    builder.field(Fields.VERSION, version);
    builder.field(Fields.VM_NAME, vmName);
    builder.field(Fields.VM_VERSION, vmVersion);
    builder.field(Fields.VM_VENDOR, vmVendor);
    builder.dateValueField(Fields.START_TIME_IN_MILLIS, Fields.START_TIME, startTime);

    builder.startObject(Fields.MEM);
    builder.byteSizeField(Fields.HEAP_INIT_IN_BYTES, Fields.HEAP_INIT, mem.heapInit);
    builder.byteSizeField(Fields.HEAP_MAX_IN_BYTES, Fields.HEAP_MAX, mem.heapMax);
    builder.byteSizeField(Fields.NON_HEAP_INIT_IN_BYTES, Fields.NON_HEAP_INIT, mem.nonHeapInit);
    builder.byteSizeField(Fields.NON_HEAP_MAX_IN_BYTES, Fields.NON_HEAP_MAX, mem.nonHeapMax);
    builder.byteSizeField(Fields.DIRECT_MAX_IN_BYTES, Fields.DIRECT_MAX, mem.directMemoryMax);
    builder.endObject();

    builder.field(Fields.GC_COLLECTORS, gcCollectors);
    builder.field(Fields.MEMORY_POOLS, memoryPools);

    if (useCompressedOops != null) {
        builder.field(Fields.USING_COMPRESSED_OOPS, useCompressedOops);
    }

    builder.endObject();
    return builder;
}
 
開發者ID:baidu,項目名稱:Elasticsearch,代碼行數:29,代碼來源:JvmInfo.java

示例3: toXContent

import org.elasticsearch.common.xcontent.XContentBuilder; //導入方法依賴的package包/類
@Override
public XContentBuilder toXContent(XContentBuilder builder, Params params) throws IOException {

    builder.field(Fields.ID, shardId.id());
    builder.field(Fields.TYPE, type.toString());
    builder.field(Fields.STAGE, stage.toString());
    builder.field(Fields.PRIMARY, primary);
    builder.dateValueField(Fields.START_TIME_IN_MILLIS, Fields.START_TIME, timer.startTime);
    if (timer.stopTime > 0) {
        builder.dateValueField(Fields.STOP_TIME_IN_MILLIS, Fields.STOP_TIME, timer.stopTime);
    }
    builder.timeValueField(Fields.TOTAL_TIME_IN_MILLIS, Fields.TOTAL_TIME, timer.time());

    if (restoreSource != null) {
        builder.field(Fields.SOURCE);
        restoreSource.toXContent(builder, params);
    } else {
        builder.startObject(Fields.SOURCE);
        builder.field(Fields.ID, sourceNode.id());
        builder.field(Fields.HOST, sourceNode.getHostName());
        builder.field(Fields.TRANSPORT_ADDRESS, sourceNode.address().toString());
        builder.field(Fields.IP, sourceNode.getHostAddress());
        builder.field(Fields.NAME, sourceNode.name());
        builder.endObject();
    }

    builder.startObject(Fields.TARGET);
    builder.field(Fields.ID, targetNode.id());
    builder.field(Fields.HOST, targetNode.getHostName());
    builder.field(Fields.TRANSPORT_ADDRESS, targetNode.address().toString());
    builder.field(Fields.IP, targetNode.getHostAddress());
    builder.field(Fields.NAME, targetNode.name());
    builder.endObject();

    builder.startObject(Fields.INDEX);
    index.toXContent(builder, params);
    builder.endObject();

    builder.startObject(Fields.TRANSLOG);
    translog.toXContent(builder, params);
    builder.endObject();

    builder.startObject(Fields.VERIFY_INDEX);
    verifyIndex.toXContent(builder, params);
    builder.endObject();

    return builder;
}
 
開發者ID:baidu,項目名稱:Elasticsearch,代碼行數:49,代碼來源:RecoveryState.java


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