Parallel execution of bulk request

As it is known that the order of execution of requests in a bulk request is not guaranteed, reason being the execution can happen on different nodes. But I'm curious to know what would happen in a case when the bulk request contain all the request for a single document id.

Lets assume a bulk request has three requests R1, R2, R3 where,
R1 : updates document with document id D1
R2 : updates document with document id D1
R3 : delete document with document id D1

Is it possible that R3 executes before R1 or R2 even though all these requests will be executed on the same node as all of them are for document D1?

If a bulk contains multiple operations on the same document then they are processed in order. However this is rather inefficient and if at all possible you should prefer to combine these operations into a single one before sending them to Elasticsearch. In your example, it would save a lot of time simply to delete the document and not send the two updates to Elasticsearch at all.

1 Like

Thanks for the clarification :slight_smile:

The example was hypothetical just for the sake of clarity. Thanks for the suggestion though as the point you mentioned are worth taking a note.

1 Like

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