# How can I completely purge docs.deleted for an index?

**URL:** <https://discuss.elastic.co/t/how-can-i-completely-purge-docs-deleted-for-an-index/51524>\
**Category:** Elasticsearch\
**Created:** [June 1, 2016, 8:26am UTC](https://discuss.elastic.co/t/how-can-i-completely-purge-docs-deleted-for-an-index/51524 "2016-06-01T08:26:41Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![Hacksign](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/hacksign/32/5918_2.png) [@Hacksign](https://discuss.elastic.co/u/Hacksign)\
**Post date:** [June 1, 2016, 8:26am UTC](https://discuss.elastic.co/t/how-can-i-completely-purge-docs-deleted-for-an-index/51524/1 "2016-06-01T08:26:41Z")

</div>

I'v done cleaning index with following command:

> > curl -XPOST '[http://localhost:9200/my-indices-\*/\_forcemerge?only\_expunge\_deletes=true&max\_num\_segments=1&flush=true](http://localhost:9200/my-indices-*/_forcemerge?only_expunge_deletes=true&max_num_segments=1&flush=true)'

But there is still numbers of docs.deleted docs left in index.  
How can I completely delete these deleted documents in index ?

---

<div class="post-metadata">

**Author:** ![mikemccand](https://avatars.discourse-cdn.com/v4/letter/m/f04885/32.png) [@mikemccand](https://discuss.elastic.co/u/mikemccand)\
**Post date:** [June 1, 2016, 9:49am UTC](https://discuss.elastic.co/t/how-can-i-completely-purge-docs-deleted-for-an-index/51524/2 "2016-06-01T09:49:50Z")

</div>

You need to set `index.merge.policy.expunge_deletes_allowed` to 0 (it defaults to 10%), but force merge, even with `only_expunge_deletes`, is a costly operation and insisting on 0% deletes just makes it more so!

---

<div class="post-metadata">

**Author:** ![Hacksign](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/hacksign/32/5918_2.png) [@Hacksign](https://discuss.elastic.co/u/Hacksign)\
**Post date:** [June 1, 2016, 9:56am UTC](https://discuss.elastic.co/t/how-can-i-completely-purge-docs-deleted-for-an-index/51524/3 "2016-06-01T09:56:12Z")

</div>

Thanks for your reply.  
I just need index takes as few storeage space as possible.  
So I can ignore the cost ..

---

<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:** [July 5, 2017, 10:47pm UTC](https://discuss.elastic.co/t/how-can-i-completely-purge-docs-deleted-for-an-index/51524/4 "2017-07-05T22:47:20Z")

</div>


