Hi.
ES - 7.2.0.
I created template with property
_"timestamp": {
"type": "date_nanos",
"format": "epoch_millis"
}_
But for 1558627800000000000 value I get _[date_nanos] in document with id 'bwjIt2sBHKc_ISRgNqQB', caused by: date[+49392918-10-14T02:40:00Z] is after 2262-04-11T23:47:16.854775807 and cannot be stored in nanosecond resolution, illegal_argument_exception_
Why?
This is explained in the documentation. We store the date_nanos as a long representing nanoseconds since the epoch so this limits the range of date that we can represent.
Thanks for reply @jimczi.
I read the documentation. But 1558627800000000000 value is 5/23/2019, 7:10:00 PM.
If you enter it in the _Convert epoch timestamp to date_ field on https://www.freeformatter.com/epoch-timestamp-to-date-converter.html page.
And I don't understand why elastic convert it to the strange date[+49392918-10-14T02:40:00Z].
In your example the format is set to epoch_millis so the long value that is provided is interpreted as a number of milliseeconds since epoch. 1558627800000000000 in milliseconds since epoch is indeed [+49392918-10-14T02:40:00Z]., we don't provide an epoch_nanos format so if you want to index dates with nanoseconds you'll need to use a string and the strict_date_optional_time like explained in the example of the documentation (see example 3 and 4).
Hi @jimczi could you please provide example how to define an index in such fashion?
reading the documentation:
strict_date_optional_time_nanos
A generic ISO datetime parser, where the date must include the year at a minimum, and the time (separated by T), is optional. The fraction of a second part has a nanosecond resolution. Examples: yyyy-MM-dd'T'HH:mm:ss.SSSSSSZ or yyyy-MM-dd.
Meaning I need first somehow turn 1558627800000000000 to the this format..... seems like missing support for nanos....