If I have a document, that's being saved with a key, and a document already
exists with that same key, is there any way to only save "newest" document?
For example, if I have a key abc, and a date 2013-08-10 and a document
comes in with key abc and an older date, any way to let es know and ignore
the update, since the document is older? And if a newer document comes in,
then overwrite abc with newer document. I am concerned that if I pull the
value to compare in the code, then in a multi-threaded environment, I could
still lose the latest doc. Not to say that same can't happen within ES, but
just curious if I set _version field or something to time stamp, would that
do anything or any way to force saving only latest?
I think that setting version_type to external could help here. Send date in ms as version number.
You should get failures in case of indexing with an older value.
--
David
Twitter : @dadoonet / @elasticsearchfr / @scrutmydocs
If I have a document, that's being saved with a key, and a document already exists with that same key, is there any way to only save "newest" document?
For example, if I have a key abc, and a date 2013-08-10 and a document comes in with key abc and an older date, any way to let es know and ignore the update, since the document is older? And if a newer document comes in, then overwrite abc with newer document. I am concerned that if I pull the value to compare in the code, then in a multi-threaded environment, I could still lose the latest doc. Not to say that same can't happen within ES, but just curious if I set _version field or something to time stamp, would that do anything or any way to force saving only latest?
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.