# After 10 millions documents deleted, I just won 500 mo

**URL:** https://discuss.elastic.co/t/after-10-millions-documents-deleted-i-just-won-500-mo/69278
**Category:** Elasticsearch
**Created:** [December 16, 2016, 10:05am UTC](https://discuss.elastic.co/t/after-10-millions-documents-deleted-i-just-won-500-mo/69278 "2016-12-16T10:05:32Z")
**Posts on this page:** 5
**Page:** 1

<div class="post-metadata">

### Author: ![\_Alexwii](https://avatars.discourse-cdn.com/v4/letter/_/bbce88/32.png) [@\_Alexwii](https://discuss.elastic.co/u/_Alexwii)
#### Post date: [December 16, 2016, 10:05am UTC](https://discuss.elastic.co/t/after-10-millions-documents-deleted-i-just-won-500-mo/69278/1 "2016-12-16T10:05:32Z")

</div>

Hello everyone,

I need to delete some documents with a particular field with "Delete by query". All is ok, 10 millions are deleted, I go from 14 million to over 4 million.

Before the removal, I was at 9,8 giga. After the removal... 9.3. I just won 500mo ?!

Why ? I must do an additional action ?

Thank you so much for your answers.

---

<div class="post-metadata">

### Author: ![dadoonet](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/dadoonet/32/137187_2.png) [@dadoonet](https://discuss.elastic.co/u/dadoonet)
#### Post date: [December 16, 2016, 11:01am UTC](https://discuss.elastic.co/t/after-10-millions-documents-deleted-i-just-won-500-mo/69278/2 "2016-12-16T11:01:16Z")

</div>

That's the way delete documents works.  
It creates new files marking documents as deleted.

Then after a period of time everything is compacted and you can get the space back.  
Note that you can run forcemerge API to force this. It will use a lot of IOs though.

That's the reason it's often better to reindex 4m docs than deleting 10m!

Reindex API makes that even easier.

---

<div class="post-metadata">

### Author: ![\_Alexwii](https://avatars.discourse-cdn.com/v4/letter/_/bbce88/32.png) [@\_Alexwii](https://discuss.elastic.co/u/_Alexwii)
#### Post date: [December 19, 2016, 12:03pm UTC](https://discuss.elastic.co/t/after-10-millions-documents-deleted-i-just-won-500-mo/69278/3 "2016-12-19T12:03:41Z")

</div>

Thank your for your answer.

It's workable to reindex with an elasticsearch query ?

---

<div class="post-metadata">

### Author: ![dadoonet](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/dadoonet/32/137187_2.png) [@dadoonet](https://discuss.elastic.co/u/dadoonet)
#### Post date: [December 19, 2016, 12:41pm UTC](https://discuss.elastic.co/t/after-10-millions-documents-deleted-i-just-won-500-mo/69278/4 "2016-12-19T12:41:41Z")

</div>

Yes.

---

<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: [January 16, 2017, 12:41pm UTC](https://discuss.elastic.co/t/after-10-millions-documents-deleted-i-just-won-500-mo/69278/5 "2017-01-16T12:41:40Z")

</div>

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