Kibana v 7.9.2的精确格式为hour_minute_second [英] Kibana v 7.9.2 exact format for hour_minute_second
问题描述
我关注了
和
hour_minute_second_fraction
所需的格式为 HH:mm:ss.SSS
,因此在您的情况下,这意味着 12:50:30.400
如果您想继续使用 12_50_30_40
,则需要设置自己的格式,如下所示:
运行时":{"type":"date",格式":"HH_mm_ss_SS"},
I followed
and https://www.elastic.co/guide/en/elasticsearch/reference/current/mapping-date-format.html but I could not find the answer that required .
I created index using
GET film/_mapping
Also as per the accepted answer in Elasticsearch: Datatype for time(HH:mm:ss.SSS) field
I created my mapping as per below .
PUT film/_mapping
{
"properties": {
"filmname": {
"type": "keyword"
},
"runtime": {
"type": "date",
"format": "hour_minute_second_fraction"
},
"genre": {
"type": "text"
},
"releasedate":{
"type": "date",
"format": "yyyy-MM-dd"
},
"budget":{
"type": "double"
}
}
}
I tried to add a document using below request .
PUT film/_doc/1/
{
"film": "The Terminator",
"runtime": "12_50_30_40",
"genre": "SCIFI war Action",
"releasedate": "1984-11-30",
"budget" : "45.12"
}
But it throws the attached error , actually I want to add this field only in hour_minute_second format.
The format expected by hour_minute_second_fraction
is HH:mm:ss.SSS
, so in your case, it would mean 12:50:30.400
If you want to keep using 12_50_30_40
, then you need to set your own format, like this:
"runtime": {
"type": "date",
"format": "HH_mm_ss_SS"
},
这篇关于Kibana v 7.9.2的精确格式为hour_minute_second的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!