# Delete documents completely from Elasticsearch

**URL:** <https://discuss.elastic.co/t/delete-documents-completely-from-elasticsearch/99416>\
**Category:** Elasticsearch\
**Created:** [September 5, 2017, 12:01pm UTC](https://discuss.elastic.co/t/delete-documents-completely-from-elasticsearch/99416 "2017-09-05T12:01:33Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![elk\_user1](https://avatars.discourse-cdn.com/v4/letter/e/a698b9/32.png) [@elk\_user1](https://discuss.elastic.co/u/elk_user1)\
**Post date:** [September 5, 2017, 12:01pm UTC](https://discuss.elastic.co/t/delete-documents-completely-from-elasticsearch/99416/1 "2017-09-05T12:01:33Z")

</div>

Hi,

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.

---

<div class="post-metadata">

**Author:** ![jpountz](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/jpountz/32/45836_2.png) [@jpountz](https://discuss.elastic.co/u/jpountz)\
**Post date:** [September 6, 2017, 4:57pm UTC](https://discuss.elastic.co/t/delete-documents-completely-from-elasticsearch/99416/2 "2017-09-06T16:57:09Z")

</div>

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.

---

<div class="post-metadata">

**Author:** ![elk\_user1](https://avatars.discourse-cdn.com/v4/letter/e/a698b9/32.png) [@elk\_user1](https://discuss.elastic.co/u/elk_user1)\
**Post date:** [September 19, 2017, 8:58am UTC](https://discuss.elastic.co/t/delete-documents-completely-from-elasticsearch/99416/3 "2017-09-19T08:58:10Z")

</div>

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?

---

<div class="post-metadata">

**Author:** ![system](https://us1.discourse-cdn.com/elastic/original/3X/1/a/1ac57faf039f6b580b3f104ef42a2a89e41014de.png) [@system](https://discuss.elastic.co/u/system)\
**Post date:** [October 17, 2017, 9:05am UTC](https://discuss.elastic.co/t/delete-documents-completely-from-elasticsearch/99416/4 "2017-10-17T09:05:44Z")

</div>

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