Doubt in conflicting version behavior


I'am having conflit's and just wanna know internal behavior of elastic that cause conflit's.

I'am using Java API 5.1.1 for load of documents to elastic.
I use bulk upsert and after a cicle with update with a script, and receive some conflit's (probably i send request to faster to same index and same document).

I know that version is important, and elastic work with version of a document (I think so), but in which moment elastic request a version of a document to posteriorly update them?

Elastic is assincronous, so suppose that in each request it will be passed on to queue.
If elastic receive a partial update on a document and a milisecond after receiving another request to set the value of a field based on the script sent and is nothing about the field previous alter, do not need to exist any conflit.

Also I notice that version 6.6 allow persitence on conflit, but do not belive that the team that is inserted will allow migration.

Standard ElasticSearch : 5.6.4
JAVA : 1.8_191
Windows 10 Build 1809

Elasticsearch does not do partial updates. If you update a document you update the whole document, which increments its version number. This can definitely result in conflicts if you are concurrently updating the same document twice.

Bulk updates are synchronous: you get a response once all the updates have been applied.

If elastic receive multi-thread synchronous bulk request will conflit, this is my bad. Do you have a opinion on best approach to load elastic ? I have a lot of updates in a close time window on same index and document

I suggest consolidating the updates to each document on the client side, and then sending batches of these consolidated updates.

1 Like

Ok, thanks.
That will be our next step.

Is there a order that elastic follow on Bulk updates? The request are under a ArrayList so order is maintained, my question is elastic will follow that order?

If there are multiple operations on a single document in a bulk request then these are processed in order. There is no ordering guarantee across operations on separate documents. See here:

1 Like

This topic was automatically closed 28 days after the last reply. New replies are no longer allowed.