Search code examples
elasticsearchelasticsearch-mapping

Elasticsearch: Datatype for time(HH:mm:ss.SSS) field


I want to index one field that contains only time in HH:mm:ss.SSS format. Which datatype I can use to store this field in elasticsearch.


Solution

  • You can use the date mapping type with a specific date format to accomodate your data:

    {
      "my_field": {
        "type": "date",
        "format": "hour_minute_second_fraction"
    
      }
    }