Kibana v 7.9.2 exact format for hour_minute_second

367 views Asked by At

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. enter image description here

1

There are 1 answers

2
Val On BEST ANSWER

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