On 1/23/2019 5:58 AM, Andreas Nilsson wrote:
Related: in the case where I cannot rely on the operations order in a single update 
request, is there a recommended way to do these kinds of updates "atomically" 
in a single request? Ideally, I obviously don't want the collection to be left in a state 
where the deletion has happened but not the additions or the other way around.

Assuming that you have a uniqueKey field and that you are replacing an existing document, do not issue a delete for that document at all.  When you index a document with the same value in the uniqueKey field as an existing document, Solr will handle the delete of the existing document for you.

When a uniqueKey is present, you should only issue delete commands for documents that will be permanently deleted.

Alternatively, send deletes in their own request, separate from inserts.  If you take this route, wait for acknowledgement from the delete before sending the insert.

Thanks,
Shawn

Reply via email to