Hi,
I have a timestamp field that I want to index as 'date' type. It holds
milliseconds since 1970/01/01.
Is it possible to get ES to index it as 'date'?
J
Hi,
I have a timestamp field that I want to index as 'date' type. It holds
milliseconds since 1970/01/01.
Is it possible to get ES to index it as 'date'?
J
Why not store two fields?
On your end, you can easily turn those milliseconds since 1970/01/01
into a date/time value to store, and you can also store the number of
milliseconds in a numeric field.
This way, you can index on both and perform the appropriate search
when needed for a small computational cost when inserting/updating.
- Nick
-----Original Message-----
From: jlee [mailto:jlee119@gmail.com]
Sent: Thursday, March 03, 2011 11:34 AM
To: users
Subject: Is it possible to have milliseconds since 1970/01/01 indexed as
'date' type?
Hi,
I have a timestamp field that I want to index as 'date' type. It holds
milliseconds since 1970/01/01.
Is it possible to get ES to index it as 'date'?
J
The date type already stores internally the date as UTC milliseconds since epoch. There is no option to provide the milliseconds directly, I guess the more interesting question here, if it was allowed, is how to handle time zone when providing just milliseconds. The date field mapper can get the milliseconds and make sure its in UTC, but that will be based on the local machine it is running on, and not (possibly) the client machine.
It might just be simpler to convert it to an ISO date format, and push that into elasticsearch.
On Thursday, March 3, 2011 at 7:53 PM, Administrator wrote:
Why not store two fields?
On your end, you can easily turn those milliseconds since 1970/01/01
into a date/time value to store, and you can also store the number of
milliseconds in a numeric field.This way, you can index on both and perform the appropriate search
when needed for a small computational cost when inserting/updating.
- Nick
-----Original Message-----
From: jlee [mailto:jlee119@gmail.com]
Sent: Thursday, March 03, 2011 11:34 AM
To: users
Subject: Is it possible to have milliseconds since 1970/01/01 indexed as
'date' type?Hi,
I have a timestamp field that I want to index as 'date' type. It holds
milliseconds since 1970/01/01.Is it possible to get ES to index it as 'date'?
J
© 2020. All Rights Reserved - Elasticsearch
Apache, Apache Lucene, Apache Hadoop, Hadoop, HDFS and the yellow elephant logo are trademarks of the Apache Software Foundation in the United States and/or other countries.