Bulk indexing depending on a "delete by query"


Is it safe to have an bulk indexing operation depending on a "delete by query"?

Lets say that I have 10 car document within my index, 5 of them of brand BMW, I perform a bulk indexing of 10 more BMW cars but before I perform the bulk indexing I delete all cars where brand equals to BMW.

Can the "earlier" executed "delete by query"-call affect documents indexed by the bulk index?


It would be interesting to understand the use case whereby you want to delete the 5 BMW docs before indexing 10 new. Such as a car dealership? Delete 5 old stock and index 10 of the latest?

I see not reason why a delete would the falter the subsequent bulk. They will use their own threads.

See here if you are interested in using the conflicts parameter with the _delete_by_query : https://www.elastic.co/guide/en/elasticsearch/reference/current/docs-delete-by-query.html

Hi Jymit,

Thanks for your reply!

The case is a bit simplified, when indexing we don't know which docs that should be deleted, indexed or re-indexed because the "key" (within the primary car-storage) for the car-document is changing between every bulk-index.

So the simplest solution for us would be to delete all docs by a given category then re-index all documents for that category, maybe that's a bad idea?

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