弹性搜索中的商店日期格式 [英] Store Date Format in elasticsearch
问题描述
该文件如下:
我遇到一个问题,当我想添加一个datetime字符串到Elasticsearch。
{LastUpdate:2013/07/24 00:00:00}
此文件引发了一个错误,它是NumberFormatException[对于输入字符串:\20130724 00:00:00\]
我知道我可以使用Elasticsearch中的日期格式,但即使我在网站上阅读文档也不知道如何使用。
{LastUpdate:{
properties:{
type:date,
格式:yyyy-MM-dd}
}
}
和
{LastUpdate:{
type:date,
format :yyyy-MM-dd
}
}
如何将日期时间字符串转换为Elasticsearch中的日期格式?
如何存储日期时间字符串可怕ctly into Elasticsearch?
你几乎在那里。设置这样的映射:
{LastUpdate:{
type:date,
格式:yyyy / MM / dd HH:mm:ss}
}
祝你好运!
I met a problem when I want to add one datetime string into Elasticsearch.
The document is below:
{"LastUpdate" : "2013/07/24 00:00:00"}
This document raised an error which is "NumberFormatException" [For input string: \"20130724 00:00:00\"]
I know that I can use the Date Format in Elasticsearch, but I don't know how to use even I read the document on the website.
{"LastUpdate": {
"properties": {
"type": "date",
"format": "yyyy-MM-dd"}
}
}
and
{"LastUpdate": {
"type": "date",
"format": "yyyy-MM-dd"
}
}
are wrong.
How can I transfer the datetime string into date format in Elasticsearch?
How can I store the datetime string directly into Elasticsearch?
You are nearly there. Set your mapping like this:
{"LastUpdate": {
"type" : "date",
"format" : "yyyy/MM/dd HH:mm:ss"}
}
Read the docs on the date mapping and its options and the date format parameter (one of the options to the date mapping).
Good luck!
这篇关于弹性搜索中的商店日期格式的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!