识别Kibana和ElasticSearch中的时间戳 [英] Recognising timestamps in Kibana and ElasticSearch

查看:2033
本文介绍了识别Kibana和ElasticSearch中的时间戳的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我是ElasticSearch和Kibana的新手,无法让Kibana认出我的时间戳。

I'm new to ElasticSearch and Kibana and am having trouble getting Kibana to recognise my timestamps.

我有一个JSON文件,我想要很多数据使用Curl插入弹性搜索。以下是JSON条目之一的示例。

I have a JSON file with lots of data that I wish to insert into Elasticsearch using Curl. Here is an example of one of the JSON entries.

{"index":{"_id":"63"}}
{"account_number":63,"firstname":"Hughes","lastname":"Owens", "email":"hughesowens@valpreal.com", "_timestamp":"2013-07-05T08:49:30.123"}

我尝试使用以下命令在Elasticsearch中创建一个索引:

I have tried to create an index in Elasticsearch using the command:

curl -XPUT 'http://localhost:9200/test/'

然后,我尝试为时间戳设置适当的映射:

I have then tried to set up an appropriate mapping for the timestamp:

curl -XPUT 'http://localhost:9200/test/container/_mapping' -d'
{
"container" : {
"_timestamp" : {
"_timestamp" : {"enabled: true, "type":"date", "format": "date_hour_minute_second_fraction", "store":true}
}
}
}'

//时间戳的格式来自 http://www.elast icsearch.org/guide/en/elasticsearch/reference/current/mapping-date-format.html

// format of timestamp from http://www.elasticsearch.org/guide/en/elasticsearch/reference/current/mapping-date-format.html

然后我试图大量插入我的数据:

I then have tried to bulk insert my data:

curl -XPOST 'localhost:9200/test/container/_bulk?pretty' --data-binary @myfile.json

所有这些命令都无故障运行,但是在Kibana中查看数据时,_timestamp字段未被识别。通过时间戳进行排序不起作用,并尝试使用不同时期过滤数据不起作用。任何关于为什么发生这个问题的想法都是受到尊重的。

All of these commands run without fault however when the data is viewed in Kibana the _timestamp field is not being recognised. Sorting via the timestamp does not work and trying to filter the data using different periods does not work. Any ideas on why this problem is occuring is appricieated.

推荐答案

管理解决问题。所以对于有任何其他问题的人:

Managed to solve the problem. So for anyone else having this problem:

我们保存日期的格式不正确,需要:

The format we had our date saved in was incorrect, needed to be :

"_timestamp":"2013-07-05 08:49:30.123"

那么我们的映射需要是:

then our mapping needed to be:

curl -XPUT 'http://localhost:9200/test/container/_mapping' -d'
{
"container" : {
"_timestamp" : {"enabled": true, "type":"date", "format": "yyyy-MM-dd HH:mm:ss.SSS", "store":true, "path" : "_timestamp"}
}
}'

希望这有助于某人。

这篇关于识别Kibana和ElasticSearch中的时间戳的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆