Externally-provided timestamp being overridden


(Michael Sokolov) #1

I need to be able to provide timestamps that will be preserved by ES. I'm
using the _timestamp field (although perhaps I shouldn't, because) it seems
that the values I provide are being ignored, and the current date-time is
being inserted instead. My mapping configuration looks like this:

dynamic: strict

_source:
enabled: false

_all:
enabled: false

_timestamp:
type: date
enabled: true
index: not_analyzed
store: true

properties:
...

I've tried providing the times as longs, as longs converted to strings, as
ISO-formatted date-times (YYYYMMDDThhmmss.SSS), but nothing seems to have
any effect -- I might as well provide 0.

I'm inserting documents using the Java client API by creating a Map, with
key="_timestamp" and values as described above.

Has anybody run across this before? It seems like a very standard use case
if you want to keep a consistent timestamp across a cluster, or in any way
copy documents without updating their timestamps.

-Mike

--
You received this message because you are subscribed to the Google Groups "elasticsearch" group.
To unsubscribe from this group and stop receiving emails from it, send an email to elasticsearch+unsubscribe@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/elasticsearch/bc9de57c-e20d-45bc-8fb1-4537177e277b%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


(Michael Sokolov) #2

quick follow-up -- of course using my own long-valued field seems to work
just fine, but I would still like to understand what's going on here. It
might be nice to have the internally-generated behavior as a fallback?

On Sunday, April 6, 2014 1:18:55 PM UTC-4, Michael Sokolov wrote:

I need to be able to provide timestamps that will be preserved by ES. I'm
using the _timestamp field (although perhaps I shouldn't, because) it seems
that the values I provide are being ignored, and the current date-time is
being inserted instead. My mapping configuration looks like this:

dynamic: strict

_source:
enabled: false

_all:
enabled: false

_timestamp:
type: date
enabled: true
index: not_analyzed
store: true

properties:
...

I've tried providing the times as longs, as longs converted to strings, as
ISO-formatted date-times (YYYYMMDDThhmmss.SSS), but nothing seems to have
any effect -- I might as well provide 0.

I'm inserting documents using the Java client API by creating a Map, with
key="_timestamp" and values as described above.

Has anybody run across this before? It seems like a very standard use
case if you want to keep a consistent timestamp across a cluster, or in any
way copy documents without updating their timestamps.

-Mike

--
You received this message because you are subscribed to the Google Groups "elasticsearch" group.
To unsubscribe from this group and stop receiving emails from it, send an email to elasticsearch+unsubscribe@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/elasticsearch/b948a29d-92af-45c4-9491-97e9b6495615%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


(Binh Ly-2) #3

From the Java API, you should be able to do something like:

client.prepareIndex().setTimestamp(blah)

--
You received this message because you are subscribed to the Google Groups "elasticsearch" group.
To unsubscribe from this group and stop receiving emails from it, send an email to elasticsearch+unsubscribe@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/elasticsearch/646894ff-6581-43d9-a890-e701b4f29b86%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


(system) #4