Preeti,

> Could you please share your java code?
>

Can't. But I can describe it.
 

> Did you update the entire document or just one field? Our requirement is 
> update specific fields as well so just wondering how setSource would work 
> there?
>

I updated the entire document. 

But, for updating a subset of just one or more fields in an existing 
document, I first get the document (and remember its version). I then make 
my changes to the source and index it against that version. So it works as 
if I'm updating just a subset of the document.

If the update fails due to a version error, then I re-get the document and 
repeat. 

For some small number of retries before giving up, this has always worked 
for ad-hoc updates. And it has the nice benefit that if one user updates 
field A and another updates field B, the result will always contain the 
most recent versions of field A and B regardless of the order and overlap 
of the initial requests. Very cool of ES! 

Yes, it's some extra work on my part. But it was worth it to us.

Brian 

-- 
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 [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/elasticsearch/6c45edec-50d4-4e7c-8564-fd2ce804d76a%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to