Delete documents completely from Elasticsearch


I am trying to free up disk space by using delete by query API. However, no disk is getting freed up and found that deletion only marks these documents as deleted in lucene.

Our disk is already 87% full and hence once it crosses 90%, ES will fail. Can someone please guide on how to delete documents marked as deleted completely? Does indexing newer documents help in deleting these documents?

Also how feasible is it to use only_expunge_deletes=true (forcemerge API) to delete those documents? as we already have 10 million documents marked as deleted.

Please guide. Thanks in advance.

You can use the optimize API with only_expunge_deletes=true, but beware that it will be very I/O intensive as it will rewrite a significant part of your index.

hi There. Thanks for your reply. While trying to delete documents via delete_by_query, I'm unable to delete version 0 documents and unable to update those documents as well. Any luck?

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