# Merging the index with lower max\_number\_segement causing increasing index size

**URL:** <https://discuss.elastic.co/t/merging-the-index-with-lower-max-number-segement-causing-increasing-index-size/293844>\
**Category:** Elasticsearch\
**Created:** [January 10, 2022, 5:41am UTC](https://discuss.elastic.co/t/merging-the-index-with-lower-max-number-segement-causing-increasing-index-size/293844 "2022-01-10T05:41:48Z")\
**Posts on this page:** 10\
**Page:** 1

<div class="post-metadata">

**Author:** ![arvin495](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/arvin495/32/98571_2.png) [@arvin495](https://discuss.elastic.co/u/arvin495)\
**Post date:** [January 10, 2022, 5:41am UTC](https://discuss.elastic.co/t/merging-the-index-with-lower-max-number-segement-causing-increasing-index-size/293844/1 "2022-01-10T05:41:48Z")

</div>

Hello Team,

We have performed force merging on one index size of 74GB with 2 shards (primary + replica) and 36 segments (primary + replica) to remove deleted docs.

```auto
curl -s -X POST "https://elasticsearch.com/index/_forcemerge?only_expunge_deletes=true&max_num_segments=18"

```

The index size kept on increasing - in 20 mins 74 to 88GB. Is it normal?

---

<div class="post-metadata">

**Author:** ![warkolm](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/warkolm/32/39224_2.png) [@warkolm](https://discuss.elastic.co/u/warkolm)\
**Post date:** [January 10, 2022, 5:45am UTC](https://discuss.elastic.co/t/merging-the-index-with-lower-max-number-segement-causing-increasing-index-size/293844/2 "2022-01-10T05:45:13Z")

</div>

Why are you using so many segments?

---

<div class="post-metadata">

**Author:** ![arvin495](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/arvin495/32/98571_2.png) [@arvin495](https://discuss.elastic.co/u/arvin495)\
**Post date:** [January 10, 2022, 5:47am UTC](https://discuss.elastic.co/t/merging-the-index-with-lower-max-number-segement-causing-increasing-index-size/293844/3 "2022-01-10T05:47:40Z")

</div>

Already there are 36 segments. I wish to merge it to 18 so to remove the deleted docs.  
/\_forcemerge?only\_expunge\_deletes=true alone is not working

---

<div class="post-metadata">

**Author:** ![warkolm](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/warkolm/32/39224_2.png) [@warkolm](https://discuss.elastic.co/u/warkolm)\
**Post date:** [January 10, 2022, 5:48am UTC](https://discuss.elastic.co/t/merging-the-index-with-lower-max-number-segement-causing-increasing-index-size/293844/4 "2022-01-10T05:48:13Z")

</div>

You typically merge to a single segment.

---

<div class="post-metadata">

**Author:** ![arvin495](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/arvin495/32/98571_2.png) [@arvin495](https://discuss.elastic.co/u/arvin495)\
**Post date:** [January 10, 2022, 5:50am UTC](https://discuss.elastic.co/t/merging-the-index-with-lower-max-number-segement-causing-increasing-index-size/293844/5 "2022-01-10T05:50:02Z")

</div>

Is it fine to rerun the same command as existing task going on?

---

<div class="post-metadata">

**Author:** ![warkolm](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/warkolm/32/39224_2.png) [@warkolm](https://discuss.elastic.co/u/warkolm)\
**Post date:** [January 10, 2022, 5:54am UTC](https://discuss.elastic.co/t/merging-the-index-with-lower-max-number-segement-causing-increasing-index-size/293844/6 "2022-01-10T05:54:13Z")

</div>

No, you need to wait unfortunately. You cannot cancel it either.

---

<div class="post-metadata">

**Author:** ![arvin495](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/arvin495/32/98571_2.png) [@arvin495](https://discuss.elastic.co/u/arvin495)\
**Post date:** [January 10, 2022, 5:56am UTC](https://discuss.elastic.co/t/merging-the-index-with-lower-max-number-segement-causing-increasing-index-size/293844/7 "2022-01-10T05:56:26Z")

</div>

Thanks @warkolm  
Will wait. question out of curiosity. How much space it would take overall given above numbers? any idea?

---

<div class="post-metadata">

**Author:** ![warkolm](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/warkolm/32/39224_2.png) [@warkolm](https://discuss.elastic.co/u/warkolm)\
**Post date:** [January 10, 2022, 5:59am UTC](https://discuss.elastic.co/t/merging-the-index-with-lower-max-number-segement-causing-increasing-index-size/293844/8 "2022-01-10T05:59:42Z")

</div>

What sort of data is it? What are the mapping and index settings?  
You'd normally expect it to drop, but all of those things above impact what happens.

---

<div class="post-metadata">

**Author:** ![arvin495](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/arvin495/32/98571_2.png) [@arvin495](https://discuss.elastic.co/u/arvin495)\
**Post date:** [January 10, 2022, 6:01am UTC](https://discuss.elastic.co/t/merging-the-index-with-lower-max-number-segement-causing-increasing-index-size/293844/9 "2022-01-10T06:01:04Z")

</div>

alright. will wait till this settles then execute it with single segment

---

<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:** [February 7, 2022, 6:01am UTC](https://discuss.elastic.co/t/merging-the-index-with-lower-max-number-segement-causing-increasing-index-size/293844/10 "2022-02-07T06:01:28Z")

</div>

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