Mapping Time field without date


(vinay gupta) #1

Hi

In my logs, I have time field that only capture the time of the day. What should be mapping of this field should be in Elastic.

For e.g.

07:10:20 AM

08:20:50 PM

If I define the mapping as date with "format" : "hh:mm:ss a" then I get a timestamp from 1970 and if define the mapping as string then sorting and range queries become an issue.

Thanks
Vinay


(Mark Walkom) #2

You are better of fixing it before it goes into ES.


(vinay gupta) #3

Is there a way to just create a mapping for Time without the date?

Thanks


(Mark Walkom) #4

If you really want to - https://www.elastic.co/guide/en/elasticsearch/reference/2.2/mapping-date-format.html


(system) #5