# Not able to get back the space allocated by indices after deleting

**URL:** https://discuss.elastic.co/t/not-able-to-get-back-the-space-allocated-by-indices-after-deleting/117934
**Category:** Elasticsearch
**Created:** [February 1, 2018, 5:47am UTC](https://discuss.elastic.co/t/not-able-to-get-back-the-space-allocated-by-indices-after-deleting/117934 "2018-02-01T05:47:27Z")
**Posts on this page:** 6
**Page:** 1

<div class="post-metadata">

### Author: ![happy0088](https://avatars.discourse-cdn.com/v4/letter/h/71c47a/32.png) [@happy0088](https://discuss.elastic.co/u/happy0088)
#### Post date: [February 1, 2018, 5:47am UTC](https://discuss.elastic.co/t/not-able-to-get-back-the-space-allocated-by-indices-after-deleting/117934/1 "2018-02-01T05:47:27Z")

</div>

Hi ,

I am using ES 5.5.1 which is running in CentOS on virtual box , where i deleted several indices with huge data but even after deletion am not able to get back the space allocated by them . I got to know that deletion only attaches a DELETE tag to the indices and hence i tried the below cmd as well to free up space :

`{curl -XPOST 'http://localhost:9200/_forcemerge?only_expunge_deletes=true }`

Any help would be appreciated .

Thanks in advance .

---

<div class="post-metadata">

### Author: ![Bernt\_Rostad](https://avatars.discourse-cdn.com/v4/letter/b/3ab097/32.png) [@Bernt\_Rostad](https://discuss.elastic.co/u/Bernt_Rostad)
#### Post date: [February 1, 2018, 10:54am UTC](https://discuss.elastic.co/t/not-able-to-get-back-the-space-allocated-by-indices-after-deleting/117934/2 "2018-02-01T10:54:29Z")

</div>

When you delete documents from an index they are only marked as 'deleted' and won't show up in searches but the disc space won't get reclaimed until a subsequent segment merger, which you can trigger with the \_forcemerge command that you listed.

However, if you want to get rid of the entire index it's much better just to run:

`curl -XDELETE 'http://localhost:9200/my_old_index'`

And this will result in reclaimed disc space immediately.

---

<div class="post-metadata">

### Author: ![happy0088](https://avatars.discourse-cdn.com/v4/letter/h/71c47a/32.png) [@happy0088](https://discuss.elastic.co/u/happy0088)
#### Post date: [February 1, 2018, 11:40am UTC](https://discuss.elastic.co/t/not-able-to-get-back-the-space-allocated-by-indices-after-deleting/117934/3 "2018-02-01T11:40:22Z")

</div>

I tried \_forcemerge command , but it doesnt help .  
Also, i had deleted the indices using \_head plugin UI and hence dont have the list of the indices that i deleted previously and sounable to use the explicit XDELETE curl .

---

<div class="post-metadata">

### Author: ![Bernt\_Rostad](https://avatars.discourse-cdn.com/v4/letter/b/3ab097/32.png) [@Bernt\_Rostad](https://discuss.elastic.co/u/Bernt_Rostad)
#### Post date: [February 1, 2018, 12:11pm UTC](https://discuss.elastic.co/t/not-able-to-get-back-the-space-allocated-by-indices-after-deleting/117934/4 "2018-02-01T12:11:22Z")

</div>

> [@happy0088](#):
>
> Also, i had deleted the indices using \_head plugin UI and hence dont have the list of the indices

I haven't used that plugin myself but from what you wrote earlier, about the disc space not getting reclaimed, it sounds as if no index was actually deleted and that they still exist (though all documents in them may have been marked as deleted).

You can verify if an index still exists by running this curl command

`curl -XGET "http://localhost/my_old_index/_settings?pretty"`

If you get an ` index_not_found_exception` then there is no such index.

---

<div class="post-metadata">

### Author: ![val](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/val/32/138203_2.png) [@val](https://discuss.elastic.co/u/val)
#### Post date: [February 1, 2018, 12:16pm UTC](https://discuss.elastic.co/t/not-able-to-get-back-the-space-allocated-by-indices-after-deleting/117934/5 "2018-02-01T12:16:40Z")

</div>

By default, a setting called `index.merge.policy.expunge_deletes_allowed` sets the the percentage of deleted documents at which the deletion happens. By default, this is set at 10%, so as long as your deleted documents don't amount to 10% of your index, the space won't be reclaimed.

And `only_expunge_deletes` won't override the above setting.

---

<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: [March 1, 2018, 12:16pm UTC](https://discuss.elastic.co/t/not-able-to-get-back-the-space-allocated-by-indices-after-deleting/117934/6 "2018-03-01T12:16:41Z")

</div>

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