Kibana v 7.9.2 exact format for hour_minute_second

∥☆過路亽.° 提交于 2020-12-13 03:30:59

问题


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.


回答1:


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"
},


来源:https://stackoverflow.com/questions/64384551/kibana-v-7-9-2-exact-format-for-hour-minute-second

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!