# Set the min size of a segment?

**URL:** https://discuss.elastic.co/t/set-the-min-size-of-a-segment/67148
**Category:** Elasticsearch
**Created:** [November 25, 2016, 3:04am UTC](https://discuss.elastic.co/t/set-the-min-size-of-a-segment/67148 "2016-11-25T03:04:50Z")
**Posts on this page:** 4
**Page:** 1

<div class="post-metadata">

### Author: ![famoss](https://avatars.discourse-cdn.com/v4/letter/f/67e7ee/32.png) [@famoss](https://discuss.elastic.co/u/famoss)
#### Post date: [November 25, 2016, 3:04am UTC](https://discuss.elastic.co/t/set-the-min-size-of-a-segment/67148/1 "2016-11-25T03:04:50Z")

</div>

[The Definitive Guide](https://www.elastic.co/guide/en/elasticsearch/guide/current/merge-process.html) says:

> Small segments are merged into bigger segments, which, in turn, are merged into even bigger segments.

Because my cluster has a lot of index,so there are a lot of segments,every segment consumes file handles, memory, and CPU cycles,so the usage of `heap size` always over 65%,so the cluster do `gc` frequently.

I want to reduce the number of segments,but don't want to use `_forcemerge` api.

Can i set the min size of the segment,then it will be merged?

---

<div class="post-metadata">

### Author: ![Ravi\_Shanker\_Reddy](https://avatars.discourse-cdn.com/v4/letter/r/a5b964/32.png) [@Ravi\_Shanker\_Reddy](https://discuss.elastic.co/u/Ravi_Shanker_Reddy)
#### Post date: [November 25, 2016, 4:26am UTC](https://discuss.elastic.co/t/set-the-min-size-of-a-segment/67148/2 "2016-11-25T04:26:42Z")

</div>

> [@famoss](#):
>
> Because my cluster has a lot of index

How's your index named? If it is based on dates close the indexes which is older and not used for searching.

It may help for you

> [@Adjust index.merge.policy.max\_merged\_segment value to lower result?](https://discuss.elastic.co/t/adjust-index-merge-policy-max-merged-segment-value-to-lower-result/58424):
>
> Hi, I've red this doc [[https://www.elastic.co/guide/en/elasticsearch/reference/1.7/index-modules-merge.html](https://www.elastic.co/guide/en/elasticsearch/reference/1.7/index-modules-merge.html) ] many times, but I'm not sure what is the actual result if set lower value of index.merge.policy.max\_merged\_segment. Assume I have bulk indexing for 3million docs in 30 minutes. If I set lower value than default 5GB, let's say 2.5GB, Will I have better index performance? Will I reduce number of merge that occurred? Will I get fewer segments files? Does this mean in the end, max se…

---

<div class="post-metadata">

### Author: ![jpountz](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/jpountz/32/45836_2.png) [@jpountz](https://discuss.elastic.co/u/jpountz)
#### Post date: [November 25, 2016, 10:52am UTC](https://discuss.elastic.co/t/set-the-min-size-of-a-segment/67148/3 "2016-11-25T10:52:22Z")

</div>

Maybe you should try to reduce the total number of shards you have, by either creating indices with fewer shards or creating fewer indices.

For instance, in the case that you need to have multiple tenants, a common solution is to use a single index with filtered aliases and routing.

---

<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: [December 23, 2016, 10:52am UTC](https://discuss.elastic.co/t/set-the-min-size-of-a-segment/67148/4 "2016-12-23T10:52:31Z")

</div>

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