当前位置: 首页>>代码示例>>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;未经允许,请勿转载。