# \_forcemerge and pending tasks and segment merge

**URL:** <https://discuss.elastic.co/t/-forcemerge-and-pending-tasks-and-segment-merge/44002>\
**Category:** Elasticsearch\
**Created:** [March 10, 2016, 10:08am UTC](https://discuss.elastic.co/t/-forcemerge-and-pending-tasks-and-segment-merge/44002 "2016-03-10T10:08:18Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![Karthik\_Ramachandran](https://avatars.discourse-cdn.com/v4/letter/k/f19dbf/32.png) [@Karthik\_Ramachandran](https://discuss.elastic.co/u/Karthik_Ramachandran)\
**Post date:** [March 10, 2016, 10:08am UTC](https://discuss.elastic.co/t/-forcemerge-and-pending-tasks-and-segment-merge/44002/1 "2016-03-10T10:08:18Z")

</div>

I was testing \_forcemerge and segment sizing. To start with, i used below command to see how many segments were in my index  
get \_cat/segments/mycontents?v  
The above returned around 41 segments, that varied is sizes from 1 MB to 3 GB. There were around 17 segments around 2+ gb and rest all were below 150 MB. My understanding is that issuing the below command will do optimize the segments by merging to similar size  
post /mycontents/\_forcemerge  
Though executing the same provided success message {..."successful": 1..,} I didn't see any change in segment list interms of size or documents.

CHecked if there are any pending tasks using get \_cluster/pending\_tasks, but resulted with empty task array.

Not sure if I'm missing something.

Over and above the issue, I also have below queries

1. What would be optimum size of a segment?
2. How ES computes what is the appropriate segment size. Can I configure it if I determine my shard size to be 50GB?
3. What would be the best segment size if we have highly varying document sizes. If we have more smaller documents go to single segment, the segment size might get to a normal zone - but more documents it will have when compared to other segments of the shard. What will be its impact?

Thanks for clarification

---

<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:** [March 12, 2016, 2:36am UTC](https://discuss.elastic.co/t/-forcemerge-and-pending-tasks-and-segment-merge/44002/2 "2016-03-12T02:36:17Z")

</div>

1. There isn't one
2. I don't know to that level, it'll be in the code, but maybe someone else can explain it
3. See 1

I think what is happening is that unless you pass `max_num_segments` to the API call, it'll just run the standard merge methods over the index, which then doesn't do anything as it thinks they all ok. But again I don't know down to that level for merges, hopefully someone can correct me if needed.

---

<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:08pm UTC](https://discuss.elastic.co/t/-forcemerge-and-pending-tasks-and-segment-merge/44002/3 "2017-07-05T23:08:56Z")

</div>


