Delete an nonexistent document

I would like to understand what are the implications of sending a delete by id for a document that does not exist. We have such case where we are sending delete operations for a big number of documents where almost 90% of those have been deleted previously or they dont exist.
The other alternative is to only send deletes for the document that do exists but that would require doing a get before delete, which I dont think is better.
Thank you

Welcome!

There is no consequence for the data.
It's just a useless HTTP rest request which is sent to the cluster.

yes, for the data nothing will happen, but in terms of resources and operations. which would cost more to the cluster ?

Yes. A request is a request that needs to be processed by the cluster.
If you are sending 1m of DELETE requests per second for example, you can easily imagine that there is a cost of answering all those requests.

So in a sense, it has a cost.

But it should not be hard to test your scenario against a cluster to see what is the actual cost with your real use case.

Deletes are expensive. How is it different from a delete of a nonexistent document ?
How is a delete of nonexistent compared to a get?

A delete causes Elasticsearch to first check if the document exists and then writing a tombstone record if it is. I don't think the document need to be retrieved from disk though, so I would expect this should be more efficient that first performing a get followed by a delete if the document exists.

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