es查询时间戳java_识别Kibana和ElasticSearch中的时间戳

如果您有一个新纪元时间戳,则无需制作和ISO8601日期。为了让Kibana识别该字段,因为日期必须是日期字段。

请注意,您必须将字段设置为日期类型之前您将任何数据输入到/ index/type。否则它将被存储为长期且不可更改。

简单的例子,可以被粘贴到marvel/sense插件:每个系列这些命令

# Make sure the index isn't there

DELETE /logger

# Create the index

PUT /logger

# Add the mapping of properties to the document type `mem`

PUT /logger/_mapping/mem

{

"mem": {

"properties": {

"timestamp": {

"type": "date"

},

"free": {

"type": "long"

}

}

}

}

# Inspect the newly created mapping

GET /logger/_mapping/mem

运行。

生成自由MEM日志

下面是一个简单的脚本回显到终端和日志到您的本地elasticsearch:

while ((1==1)); do memfree=`free -b|tail -n 1|tr -s ' ' ' '|cut -d ' ' -f4`; echo $load; curl -XPOST "localhost:9200/logger/mem" -d "{ \"timestamp\": `date +%s%3N`, \"free\": $memfree }"; sleep 1; done

检查数据弹性搜索

中粘贴此您marvel/sense

GET /logger/mem/_search

现在你可以移动到Kibana并做一些图表。 Kibana会自动检测你的日期字段。

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值