# Background merging does not delete documents?

**URL:** <https://discuss.elastic.co/t/background-merging-does-not-delete-documents/28597>\
**Category:** Elasticsearch\
**Created:** [September 3, 2015, 10:32am UTC](https://discuss.elastic.co/t/background-merging-does-not-delete-documents/28597 "2015-09-03T10:32:54Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![Ilija\_Subasic](https://avatars.discourse-cdn.com/v4/letter/i/ee7513/32.png) [@Ilija\_Subasic](https://discuss.elastic.co/u/Ilija_Subasic)\
**Post date:** [September 3, 2015, 10:32am UTC](https://discuss.elastic.co/t/background-merging-does-not-delete-documents/28597/1 "2015-09-03T10:32:54Z")

</div>

Hi,  
We have an index of about 10_10^6 documents. The index is dynamic and there are removals as well. In the info we see that there is around 1_10^6 deleted documents. My understanding was that these documents would be completely removed during bacground merges, but the number seems to be constant for weeks now.

I also understand that es does recommend against manually running optimize to clean up these documents. Any idea what may cause documents not to be deleted?

Thanks,  
Ilija

---

<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:** [September 3, 2015, 1:00pm UTC](https://discuss.elastic.co/t/background-merging-does-not-delete-documents/28597/2 "2015-09-03T13:00:54Z")

</div>

This probably just means your index is in steady state?

I.e., merging does reclaim the deleted, lowering the count, but the new deletions arrive and increase the count.

This post goes into some detail about deletions: [https://www.elastic.co/blog/lucenes-handling-of-deleted-documents](https://www.elastic.co/blog/lucenes-handling-of-deleted-documents)

Mike McCandless

---

<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, 11:52pm UTC](https://discuss.elastic.co/t/background-merging-does-not-delete-documents/28597/3 "2017-07-05T23:52:15Z")

</div>


