Send delete request only when inserted documents have been persisted

I'm running upsert, and right after that delete by query, however, some of the documents upserted should be picked up by the following delete request. Is there a chance to send/execute the delete request only after the documents have successfully been upserted?

Currently, if I run the commands without any delays, none of the upserted documents are deleted. I did try to add the artificial delay of several seconds, and things work out well then. If it is not possible to know the exact time documents have been persisted, is there an upper bound when can that be expected?

Yes, you need to do that in your client though as it's not something Elasticsearch tracks.

Take a look at https://www.elastic.co/guide/en/elasticsearch/reference/7.9/docs-refresh.html

Thanks, that seems to be what I was looking for.

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