# ElasticSearch - docs deleted count reduced

**URL:** <https://discuss.elastic.co/t/elasticsearch-docs-deleted-count-reduced/196729>\
**Category:** Elasticsearch\
**Created:** [August 26, 2019, 8:11am UTC](https://discuss.elastic.co/t/elasticsearch-docs-deleted-count-reduced/196729 "2019-08-26T08:11:23Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![moni15moni](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/moni15moni/32/42311_2.png) [@moni15moni](https://discuss.elastic.co/u/moni15moni)\
**Post date:** [August 26, 2019, 8:11am UTC](https://discuss.elastic.co/t/elasticsearch-docs-deleted-count-reduced/196729/1 "2019-08-26T08:11:23Z")

</div>

Hi

For debugging I have checked one of currently writing indices shows the following results

4 days before the following response i got

health status index uuid pri rep docs.count docs.deleted store.size pri.store.size  
green open order-feed--201908 ApSD8D7tSb-zC1bb92Vzrg 2 1 39864412 117962312 235.9gb 122gb

I have checked after 4 days , the recent response shows,

health status index uuid pri rep docs.count docs.deleted store.size pri.store.size  
green open order-feed--201908 ApSD8D7tSb-zC1bb92Vzrg 2 1 42360806 33008678 108gb 57gb

I would like to know the behavior of docs.deleted.

I Didn't call any force\_segments API or any other things on that index. Only update API called on that index.

How the docs.deleted count is reduced in this case. Any help would be appreciated.

---

<div class="post-metadata">

**Author:** ![spinscale](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/spinscale/32/25011_2.png) [@spinscale](https://discuss.elastic.co/u/spinscale)\
**Post date:** [August 26, 2019, 8:44am UTC](https://discuss.elastic.co/t/elasticsearch-docs-deleted-count-reduced/196729/2 "2019-08-26T08:44:29Z")

</div>

[merging happens automatically in the background](https://www.elastic.co/guide/en/elasticsearch/reference/7.3/index-modules-merge.html) and will change the number of deleted documents by reducing the number of segments and removing deleted document during that process.

---

<div class="post-metadata">

**Author:** ![moni15moni](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/moni15moni/32/42311_2.png) [@moni15moni](https://discuss.elastic.co/u/moni15moni)\
**Post date:** [August 27, 2019, 2:43pm UTC](https://discuss.elastic.co/t/elasticsearch-docs-deleted-count-reduced/196729/3 "2019-08-27T14:43:24Z")

</div>

Hi Alexandar,

Thanks for the reply, Understands merging happens automatically.

So the default merging segment size is 5 GB, the indexing process was completed in that index.

So far few segments merged with size to 5.0 GB. Other segments are not merged upto 5 GB(max segment size).

I would like to understand

Why the other segments are not merged upto 5GB, Even though no indexing happened at the index/cluster?

How the floor segments work with the index.

Can we define the max/min no of segments count for index.

FYI, We are running separate force\_merge api for older indices to make the segment 1 per shard.

---

<div class="post-metadata">

**Author:** ![spinscale](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/spinscale/32/25011_2.png) [@spinscale](https://discuss.elastic.co/u/spinscale)\
**Post date:** [August 28, 2019, 9:26am UTC](https://discuss.elastic.co/t/elasticsearch-docs-deleted-count-reduced/196729/4 "2019-08-28T09:26:08Z")

</div>

in order to decide when merging needs to happen and for which segments, lucene uses a so called merge policy. You may want to read about it in lucene, and also take a look at the [https://github.com/elastic/elasticsearch/blob/master/server/src/main/java/org/elasticsearch/index/EsTieredMergePolicy.java](https://github.com/elastic/elasticsearch/blob/master/server/src/main/java/org/elasticsearch/index/EsTieredMergePolicy.java) policy used in elasticsearch and follow the links in there.

---

<div class="post-metadata">

**Author:** ![moni15moni](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/moni15moni/32/42311_2.png) [@moni15moni](https://discuss.elastic.co/u/moni15moni)\
**Post date:** [August 28, 2019, 11:08am UTC](https://discuss.elastic.co/t/elasticsearch-docs-deleted-count-reduced/196729/5 "2019-08-28T11:08:03Z")

</div>

Thanks Alexander , Sounds good . Let me have a deep look on this.

---

<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:** [September 25, 2019, 11:08am UTC](https://discuss.elastic.co/t/elasticsearch-docs-deleted-count-reduced/196729/6 "2019-09-25T11:08:07Z")

</div>

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