# How to set max\_merged\_segment at startup?

**URL:** https://discuss.elastic.co/t/how-to-set-max-merged-segment-at-startup/5246
**Category:** Elasticsearch
**Created:** [August 25, 2011, 12:01am UTC](https://discuss.elastic.co/t/how-to-set-max-merged-segment-at-startup/5246 "2011-08-25T00:01:30Z")
**Posts on this page:** 11
**Page:** 1

<div class="post-metadata">

### Author: ![dottom](https://avatars.discourse-cdn.com/v4/letter/d/c68b51/32.png) [@dottom](https://discuss.elastic.co/u/dottom)
#### Post date: [August 25, 2011, 12:01am UTC](https://discuss.elastic.co/t/how-to-set-max-merged-segment-at-startup/5246/1 "2011-08-25T00:01:30Z")

</div>

Is there a way to set max\_merged\_segment (or any of the merge  
settings) at startup?

I can set max\_merged\_segment dynamically like this and it works as  
expected:

```
curl -XPUT localhost:9200/myindex/_settings -d '{
    "index" : {
        "merge.policy.max_merged_segment" : "2g"
    }
}'

```

What I would like to do is set these for all indexes by default at  
startup, but this does not set it:

```
index:
  number_of_shards: 1
  number_of_replicas: 0
  merge.policy.max_merged_segment: 2g

```

This does not work either:

```
index:
  number_of_shards: 1
  number_of_replicas: 0

  merge:
    policy:
      max_merged_segment: 2g

```

I have also tried substituting "max\_merge\_size" for  
"max\_merged\_segment".

---

<div class="post-metadata">

### Author: ![kimchy](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/kimchy/32/44952_2.png) [@kimchy](https://discuss.elastic.co/u/kimchy)
#### Post date: [August 26, 2011, 2:14pm UTC](https://discuss.elastic.co/t/how-to-set-max-merged-segment-at-startup/5246/2 "2011-08-26T14:14:40Z")

</div>

When you set it in the configuration file, then it will be applied if that  
node is the master, and the index gets created. You can also specify the  
same setting when you create the index as an index setting.

I see where the problem is..., in the configuration level on startup, the  
setting is misnamed, can called: max\_merge\_segment (merge instead of  
merged), I will fix that.

On Thu, Aug 25, 2011 at 3:01 AM, Tom Le [dottom@gmail.com](mailto:dottom@gmail.com) wrote:

> Is there a way to set max\_merged\_segment (or any of the merge  
> settings) at startup?
> 
> I can set max\_merged\_segment dynamically like this and it works as  
> expected:
> 
> curl -XPUT localhost:9200/myindex/\_settings -d '{  
> "index" : {  
> "merge.policy.max\_merged\_segment" : "2g"  
> }  
> }'
> 
> What I would like to do is set these for all indexes by default at  
> startup, but this does not set it:
> 
> index:  
> number\_of\_shards: 1  
> number\_of\_replicas: 0  
> merge.policy.max\_merged\_segment: 2g
> 
> This does not work either:
> 
> index:  
> number\_of\_shards: 1  
> number\_of\_replicas: 0
> 
> ```
> merge:
> policy:
> max_merged_segment: 2g
> 
> ```
> 
> I have also tried substituting "max\_merge\_size" for  
> "max\_merged\_segment".

---

<div class="post-metadata">

### Author: ![kimchy](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/kimchy/32/44952_2.png) [@kimchy](https://discuss.elastic.co/u/kimchy)
#### Post date: [August 26, 2011, 2:16pm UTC](https://discuss.elastic.co/t/how-to-set-max-merged-segment-at-startup/5246/3 "2011-08-26T14:16:56Z")

</div>

Here is the issue:  
[Tiered merge policy setting: `max_merge_segment` misnamed and should be `max_merged_segment` · Issue #1280 · elastic/elasticsearch · GitHub](https://github.com/elasticsearch/elasticsearch/issues/1280).

On Fri, Aug 26, 2011 at 5:14 PM, Shay Banon [kimchy@gmail.com](mailto:kimchy@gmail.com) wrote:

> When you set it in the configuration file, then it will be applied if that  
> node is the master, and the index gets created. You can also specify the  
> same setting when you create the index as an index setting.
> 
> I see where the problem is..., in the configuration level on startup, the  
> setting is misnamed, can called: max\_merge\_segment (merge instead of  
> merged), I will fix that.
> 
> On Thu, Aug 25, 2011 at 3:01 AM, Tom Le [dottom@gmail.com](mailto:dottom@gmail.com) wrote:
> 
> > Is there a way to set max\_merged\_segment (or any of the merge  
> > settings) at startup?
> > 
> > I can set max\_merged\_segment dynamically like this and it works as  
> > expected:
> > 
> > curl -XPUT localhost:9200/myindex/\_settings -d '{  
> > "index" : {  
> > "merge.policy.max\_merged\_segment" : "2g"  
> > }  
> > }'
> > 
> > What I would like to do is set these for all indexes by default at  
> > startup, but this does not set it:
> > 
> > index:  
> > number\_of\_shards: 1  
> > number\_of\_replicas: 0  
> > merge.policy.max\_merged\_segment: 2g
> > 
> > This does not work either:
> > 
> > index:  
> > number\_of\_shards: 1  
> > number\_of\_replicas: 0
> > 
> > ```
> > merge:
> > policy:
> > max_merged_segment: 2g
> > 
> > ```
> > 
> > I have also tried substituting "max\_merge\_size" for  
> > "max\_merged\_segment".

---

<div class="post-metadata">

### Author: ![Huy\_Le](https://avatars.discourse-cdn.com/v4/letter/h/f17d59/32.png) [@Huy\_Le](https://discuss.elastic.co/u/Huy_Le)
#### Post date: [September 20, 2011, 2:52am UTC](https://discuss.elastic.co/t/how-to-set-max-merged-segment-at-startup/5246/4 "2011-09-20T02:52:11Z")

</div>

Anyway to change merge policy (from tiered to log\_byte\_size) without  
downtime? Our production cluster currently have single master. If  
configuration in file is only taken on startup of master node, we  
won't be able to get this configuration to be read by the master on a  
single master node as when the master is leaving the cluster, a new  
node is promoted to be the new master.

Thanks!

Huy

On Aug 26, 10:14 am, Shay Banon [kim...@gmail.com](mailto:kim...@gmail.com) wrote:

> When you set it in the configuration file, then it will be applied if that  
> node is the master, and the index gets created. You can also specify the  
> same setting when you create the index as an index setting.
> 
> I see where the problem is..., in the configuration level on startup, the  
> setting is misnamed, can called: max\_merge\_segment (merge instead of  
> merged), I will fix that.
> 
> On Thu, Aug 25, 2011 at 3:01 AM, Tom Le [dot...@gmail.com](mailto:dot...@gmail.com) wrote:
> 
> > Is there a way to set max\_merged\_segment (or any of the merge  
> > settings) at startup?
> 
> > I can set max\_merged\_segment dynamically like this and it works as  
> > expected:
> 
> > curl -XPUT localhost:9200/myindex/\_settings -d '{  
> > "index" : {  
> > "merge.policy.max\_merged\_segment" : "2g"  
> > }  
> > }'
> 
> > What I would like to do is set these for all indexes by default at  
> > startup, but this does not set it:
> 
> > index:  
> > number\_of\_shards: 1  
> > number\_of\_replicas: 0  
> > merge.policy.max\_merged\_segment: 2g
> 
> > This does not work either:
> 
> > index:  
> > number\_of\_shards: 1  
> > number\_of\_replicas: 0
> 
> > ```
> > merge:
> > policy:
> > max_merged_segment: 2g
> > 
> > ```
> 
> > I have also tried substituting "max\_merge\_size" for  
> > "max\_merged\_segment".

---

<div class="post-metadata">

### Author: ![kimchy](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/kimchy/32/44952_2.png) [@kimchy](https://discuss.elastic.co/u/kimchy)
#### Post date: [September 20, 2011, 8:29am UTC](https://discuss.elastic.co/t/how-to-set-max-merged-segment-at-startup/5246/5 "2011-09-20T08:29:10Z")

</div>

There isn't an option to change the merge policy _type_ without either  
changing it in the settings and restarting the cluster. Or, closing hte  
index, updating the merge policy type, and opening it again. Why do you want  
to change the type?

On Tue, Sep 20, 2011 at 5:52 AM, Huy Le [huyle@leveragingit.com](mailto:huyle@leveragingit.com) wrote:

> Anyway to change merge policy (from tiered to log\_byte\_size) without  
> downtime? Our production cluster currently have single master. If  
> configuration in file is only taken on startup of master node, we  
> won't be able to get this configuration to be read by the master on a  
> single master node as when the master is leaving the cluster, a new  
> node is promoted to be the new master.
> 
> Thanks!
> 
> Huy
> 
> On Aug 26, 10:14 am, Shay Banon [kim...@gmail.com](mailto:kim...@gmail.com) wrote:
> 
> > When you set it in the configuration file, then it will be applied if  
> > that  
> > node is the master, and the index gets created. You can also specify the  
> > same setting when you create the index as an index setting.
> > 
> > I see where the problem is..., in the configuration level on startup, the  
> > setting is misnamed, can called: max\_merge\_segment (merge instead of  
> > merged), I will fix that.
> > 
> > On Thu, Aug 25, 2011 at 3:01 AM, Tom Le [dot...@gmail.com](mailto:dot...@gmail.com) wrote:
> > 
> > > Is there a way to set max\_merged\_segment (or any of the merge  
> > > settings) at startup?
> > 
> > > I can set max\_merged\_segment dynamically like this and it works as  
> > > expected:
> > 
> > > curl -XPUT localhost:9200/myindex/\_settings -d '{  
> > > "index" : {  
> > > "merge.policy.max\_merged\_segment" : "2g"  
> > > }  
> > > }'
> > 
> > > What I would like to do is set these for all indexes by default at  
> > > startup, but this does not set it:
> > 
> > > index:  
> > > number\_of\_shards: 1  
> > > number\_of\_replicas: 0  
> > > merge.policy.max\_merged\_segment: 2g
> > 
> > > This does not work either:
> > 
> > > index:  
> > > number\_of\_shards: 1  
> > > number\_of\_replicas: 0
> > 
> > > ```
> > > merge:
> > > policy:
> > > max_merged_segment: 2g
> > > 
> > > ```
> > 
> > > I have also tried substituting "max\_merge\_size" for  
> > > "max\_merged\_segment".

---

<div class="post-metadata">

### Author: ![Huy\_Le](https://avatars.discourse-cdn.com/v4/letter/h/f17d59/32.png) [@Huy\_Le](https://discuss.elastic.co/u/Huy_Le)
#### Post date: [September 20, 2011, 12:27pm UTC](https://discuss.elastic.co/t/how-to-set-max-merged-segment-at-startup/5246/6 "2011-09-20T12:27:34Z")

</div>

We have solr with acceptable performance with log\_byte\_size merge  
policy. We would like to try a fast track to acceptable performance  
on ES cluster by setting merge policy on ES to the same setting we  
currently on our solr cluster. The issue we are experiencing is that  
there are so many (over 100) small segment files per shard on a 30-  
shard cluster that cause ES to spend too much CPU time on merging.

Huy

On Sep 20, 4:29 am, Shay Banon [kim...@gmail.com](mailto:kim...@gmail.com) wrote:

> There isn't an option to change the merge policy _type_ without either  
> changing it in the settings and restarting the cluster. Or, closing hte  
> index, updating the merge policy type, and opening it again. Why do you want  
> to change the type?
> 
> On Tue, Sep 20, 2011 at 5:52 AM, Huy Le [hu...@leveragingit.com](mailto:hu...@leveragingit.com) wrote:
> 
> > Anyway to change merge policy (from tiered to log\_byte\_size) without  
> > downtime? Our production cluster currently have single master. If  
> > configuration in file is only taken on startup of master node, we  
> > won't be able to get this configuration to be read by the master on a  
> > single master node as when the master is leaving the cluster, a new  
> > node is promoted to be the new master.
> 
> > Thanks!
> 
> > Huy
> 
> > On Aug 26, 10:14 am, Shay Banon [kim...@gmail.com](mailto:kim...@gmail.com) wrote:
> > 
> > > When you set it in the configuration file, then it will be applied if  
> > > that  
> > > node is the master, and the index gets created. You can also specify the  
> > > same setting when you create the index as an index setting.
> 
> > > I see where the problem is..., in the configuration level on startup, the  
> > > setting is misnamed, can called: max\_merge\_segment (merge instead of  
> > > merged), I will fix that.
> 
> > > On Thu, Aug 25, 2011 at 3:01 AM, Tom Le [dot...@gmail.com](mailto:dot...@gmail.com) wrote:
> > > 
> > > > Is there a way to set max\_merged\_segment (or any of the merge  
> > > > settings) at startup?
> 
> > > > I can set max\_merged\_segment dynamically like this and it works as  
> > > > expected:
> 
> > > > curl -XPUT localhost:9200/myindex/\_settings -d '{  
> > > > "index" : {  
> > > > "merge.policy.max\_merged\_segment" : "2g"  
> > > > }  
> > > > }'
> 
> > > > What I would like to do is set these for all indexes by default at  
> > > > startup, but this does not set it:
> 
> > > > index:  
> > > > number\_of\_shards: 1  
> > > > number\_of\_replicas: 0  
> > > > merge.policy.max\_merged\_segment: 2g
> 
> > > > This does not work either:
> 
> > > > index:  
> > > > number\_of\_shards: 1  
> > > > number\_of\_replicas: 0
> 
> > > > ```
> > > > merge:
> > > > policy:
> > > > max_merged_segment: 2g
> > > > 
> > > > ```
> 
> > > > I have also tried substituting "max\_merge\_size" for  
> > > > "max\_merged\_segment".

---

<div class="post-metadata">

### Author: ![kimchy](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/kimchy/32/44952_2.png) [@kimchy](https://discuss.elastic.co/u/kimchy)
#### Post date: [September 20, 2011, 2:28pm UTC](https://discuss.elastic.co/t/how-to-set-max-merged-segment-at-startup/5246/7 "2011-09-20T14:28:52Z")

</div>

Interesting... . Those should be merged, unless they are above the  
max\_merged\_segment parameter, is that the case?

I pointed to before, just want to make sure though. You can change the merge  
policy type by closing the index, using update settings to change the merge  
policy type setting, and open the index again.

On Tue, Sep 20, 2011 at 3:27 PM, Huy Le [huyle@leveragingit.com](mailto:huyle@leveragingit.com) wrote:

> We have solr with acceptable performance with log\_byte\_size merge  
> policy. We would like to try a fast track to acceptable performance  
> on ES cluster by setting merge policy on ES to the same setting we  
> currently on our solr cluster. The issue we are experiencing is that  
> there are so many (over 100) small segment files per shard on a 30-  
> shard cluster that cause ES to spend too much CPU time on merging.
> 
> Huy
> 
> On Sep 20, 4:29 am, Shay Banon [kim...@gmail.com](mailto:kim...@gmail.com) wrote:
> 
> > There isn't an option to change the merge policy _type_ without either  
> > changing it in the settings and restarting the cluster. Or, closing hte  
> > index, updating the merge policy type, and opening it again. Why do you  
> > want  
> > to change the type?
> > 
> > On Tue, Sep 20, 2011 at 5:52 AM, Huy Le [hu...@leveragingit.com](mailto:hu...@leveragingit.com) wrote:
> > 
> > > Anyway to change merge policy (from tiered to log\_byte\_size) without  
> > > downtime? Our production cluster currently have single master. If  
> > > configuration in file is only taken on startup of master node, we  
> > > won't be able to get this configuration to be read by the master on a  
> > > single master node as when the master is leaving the cluster, a new  
> > > node is promoted to be the new master.
> > 
> > > Thanks!
> > 
> > > Huy
> > 
> > > On Aug 26, 10:14 am, Shay Banon [kim...@gmail.com](mailto:kim...@gmail.com) wrote:
> > > 
> > > > When you set it in the configuration file, then it will be applied if  
> > > > that  
> > > > node is the master, and the index gets created. You can also specify  
> > > > the  
> > > > same setting when you create the index as an index setting.
> > 
> > > > I see where the problem is..., in the configuration level on startup,  
> > > > the  
> > > > setting is misnamed, can called: max\_merge\_segment (merge instead of  
> > > > merged), I will fix that.
> > 
> > > > On Thu, Aug 25, 2011 at 3:01 AM, Tom Le [dot...@gmail.com](mailto:dot...@gmail.com) wrote:
> > > > 
> > > > > Is there a way to set max\_merged\_segment (or any of the merge  
> > > > > settings) at startup?
> > 
> > > > > I can set max\_merged\_segment dynamically like this and it works as  
> > > > > expected:
> > 
> > > > > curl -XPUT localhost:9200/myindex/\_settings -d '{  
> > > > > "index" : {  
> > > > > "merge.policy.max\_merged\_segment" : "2g"  
> > > > > }  
> > > > > }'
> > 
> > > > > What I would like to do is set these for all indexes by default at  
> > > > > startup, but this does not set it:
> > 
> > > > > index:  
> > > > > number\_of\_shards: 1  
> > > > > number\_of\_replicas: 0  
> > > > > merge.policy.max\_merged\_segment: 2g
> > 
> > > > > This does not work either:
> > 
> > > > > index:  
> > > > > number\_of\_shards: 1  
> > > > > number\_of\_replicas: 0
> > 
> > > > > ```
> > > > > merge:
> > > > > policy:
> > > > > max_merged_segment: 2g
> > > > > 
> > > > > ```
> > 
> > > > > I have also tried substituting "max\_merge\_size" for  
> > > > > "max\_merged\_segment".

---

<div class="post-metadata">

### Author: ![Huy\_Le](https://avatars.discourse-cdn.com/v4/letter/h/f17d59/32.png) [@Huy\_Le](https://discuss.elastic.co/u/Huy_Le)
#### Post date: [September 22, 2011, 5:28pm UTC](https://discuss.elastic.co/t/how-to-set-max-merged-segment-at-startup/5246/8 "2011-09-22T17:28:19Z")

</div>

The files are under max\_merged\_segment.

By closing the index, wouldn't that prevent searching from working?

Alternatively, if we have more than 1 master, if we change config in  
master 1, restart master 1, and change config in master 2 and restart  
master, then restart the rest of cluster, would that work? Related  
question, what is the procedure to changing a cluster from single  
master to more than one master?

Thanks!

Huy

On Sep 20, 10:28 am, Shay Banon [kim...@gmail.com](mailto:kim...@gmail.com) wrote:

> Interesting... . Those should be merged, unless they are above the  
> max\_merged\_segment parameter, is that the case?
> 
> I pointed to before, just want to make sure though. You can change the merge  
> policy type by closing the index, using update settings to change the merge  
> policy type setting, and open the index again.
> 
> On Tue, Sep 20, 2011 at 3:27 PM, Huy Le [hu...@leveragingit.com](mailto:hu...@leveragingit.com) wrote:
> 
> > We have solr with acceptable performance with log\_byte\_size merge  
> > policy. We would like to try a fast track to acceptable performance  
> > on ES cluster by setting merge policy on ES to the same setting we  
> > currently on our solr cluster. The issue we are experiencing is that  
> > there are so many (over 100) small segment files per shard on a 30-  
> > shard cluster that cause ES to spend too much CPU time on merging.
> 
> > Huy
> 
> > On Sep 20, 4:29 am, Shay Banon [kim...@gmail.com](mailto:kim...@gmail.com) wrote:
> > 
> > > There isn't an option to change the merge policy _type_ without either  
> > > changing it in the settings and restarting the cluster. Or, closing hte  
> > > index, updating the merge policy type, and opening it again. Why do you  
> > > want  
> > > to change the type?
> 
> > > On Tue, Sep 20, 2011 at 5:52 AM, Huy Le [hu...@leveragingit.com](mailto:hu...@leveragingit.com) wrote:
> > > 
> > > > Anyway to change merge policy (from tiered to log\_byte\_size) without  
> > > > downtime? Our production cluster currently have single master. If  
> > > > configuration in file is only taken on startup of master node, we  
> > > > won't be able to get this configuration to be read by the master on a  
> > > > single master node as when the master is leaving the cluster, a new  
> > > > node is promoted to be the new master.
> 
> > > > Thanks!
> 
> > > > Huy
> 
> > > > On Aug 26, 10:14 am, Shay Banon [kim...@gmail.com](mailto:kim...@gmail.com) wrote:
> > > > 
> > > > > When you set it in the configuration file, then it will be applied if  
> > > > > that  
> > > > > node is the master, and the index gets created. You can also specify  
> > > > > the  
> > > > > same setting when you create the index as an index setting.
> 
> > > > > I see where the problem is..., in the configuration level on startup,  
> > > > > the  
> > > > > setting is misnamed, can called: max\_merge\_segment (merge instead of  
> > > > > merged), I will fix that.
> 
> > > > > On Thu, Aug 25, 2011 at 3:01 AM, Tom Le [dot...@gmail.com](mailto:dot...@gmail.com) wrote:
> > > > > 
> > > > > > Is there a way to set max\_merged\_segment (or any of the merge  
> > > > > > settings) at startup?
> 
> > > > > > I can set max\_merged\_segment dynamically like this and it works as  
> > > > > > expected:
> 
> > > > > > curl -XPUT localhost:9200/myindex/\_settings -d '{  
> > > > > > "index" : {  
> > > > > > "merge.policy.max\_merged\_segment" : "2g"  
> > > > > > }  
> > > > > > }'
> 
> > > > > > What I would like to do is set these for all indexes by default at  
> > > > > > startup, but this does not set it:
> 
> > > > > > index:  
> > > > > > number\_of\_shards: 1  
> > > > > > number\_of\_replicas: 0  
> > > > > > merge.policy.max\_merged\_segment: 2g
> 
> > > > > > This does not work either:
> 
> > > > > > index:  
> > > > > > number\_of\_shards: 1  
> > > > > > number\_of\_replicas: 0
> 
> > > > > > ```
> > > > > > merge:
> > > > > > policy:
> > > > > > max_merged_segment: 2g
> > > > > > 
> > > > > > ```
> 
> > > > > > I have also tried substituting "max\_merge\_size" for  
> > > > > > "max\_merged\_segment".

---

<div class="post-metadata">

### Author: ![kimchy](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/kimchy/32/44952_2.png) [@kimchy](https://discuss.elastic.co/u/kimchy)
#### Post date: [September 23, 2011, 2:07pm UTC](https://discuss.elastic.co/t/how-to-set-max-merged-segment-at-startup/5246/9 "2011-09-23T14:07:21Z")

</div>

Closing the index will cause search to not work, but thats the only way to  
change the merge policy _type_.

I think you misunderstand how elasticsearch works. In a cluster, there will  
be a single master.

On Thu, Sep 22, 2011 at 8:28 PM, Huy Le [huyle@leveragingit.com](mailto:huyle@leveragingit.com) wrote:

> The files are under max\_merged\_segment.
> 
> By closing the index, wouldn't that prevent searching from working?
> 
> Alternatively, if we have more than 1 master, if we change config in  
> master 1, restart master 1, and change config in master 2 and restart  
> master, then restart the rest of cluster, would that work? Related  
> question, what is the procedure to changing a cluster from single  
> master to more than one master?
> 
> Thanks!
> 
> Huy
> 
> On Sep 20, 10:28 am, Shay Banon [kim...@gmail.com](mailto:kim...@gmail.com) wrote:
> 
> > Interesting... . Those should be merged, unless they are above the  
> > max\_merged\_segment parameter, is that the case?
> > 
> > I pointed to before, just want to make sure though. You can change the  
> > merge  
> > policy type by closing the index, using update settings to change the  
> > merge  
> > policy type setting, and open the index again.
> > 
> > On Tue, Sep 20, 2011 at 3:27 PM, Huy Le [hu...@leveragingit.com](mailto:hu...@leveragingit.com) wrote:
> > 
> > > We have solr with acceptable performance with log\_byte\_size merge  
> > > policy. We would like to try a fast track to acceptable performance  
> > > on ES cluster by setting merge policy on ES to the same setting we  
> > > currently on our solr cluster. The issue we are experiencing is that  
> > > there are so many (over 100) small segment files per shard on a 30-  
> > > shard cluster that cause ES to spend too much CPU time on merging.
> > 
> > > Huy
> > 
> > > On Sep 20, 4:29 am, Shay Banon [kim...@gmail.com](mailto:kim...@gmail.com) wrote:
> > > 
> > > > There isn't an option to change the merge policy _type_ without  
> > > > either  
> > > > changing it in the settings and restarting the cluster. Or, closing  
> > > > hte  
> > > > index, updating the merge policy type, and opening it again. Why do  
> > > > you  
> > > > want  
> > > > to change the type?
> > 
> > > > On Tue, Sep 20, 2011 at 5:52 AM, Huy Le [hu...@leveragingit.com](mailto:hu...@leveragingit.com)  
> > > > wrote:
> > > > 
> > > > > Anyway to change merge policy (from tiered to log\_byte\_size)  
> > > > > without  
> > > > > downtime? Our production cluster currently have single master.  
> > > > > If  
> > > > > configuration in file is only taken on startup of master node, we  
> > > > > won't be able to get this configuration to be read by the master on  
> > > > > a  
> > > > > single master node as when the master is leaving the cluster, a new  
> > > > > node is promoted to be the new master.
> > 
> > > > > Thanks!
> > 
> > > > > Huy
> > 
> > > > > On Aug 26, 10:14 am, Shay Banon [kim...@gmail.com](mailto:kim...@gmail.com) wrote:
> > > > > 
> > > > > > When you set it in the configuration file, then it will be  
> > > > > > applied if  
> > > > > > that  
> > > > > > node is the master, and the index gets created. You can also  
> > > > > > specify  
> > > > > > the  
> > > > > > same setting when you create the index as an index setting.
> > 
> > > > > > I see where the problem is..., in the configuration level on  
> > > > > > startup,  
> > > > > > the  
> > > > > > setting is misnamed, can called: max\_merge\_segment (merge instead  
> > > > > > of  
> > > > > > merged), I will fix that.
> > 
> > > > > > On Thu, Aug 25, 2011 at 3:01 AM, Tom Le [dot...@gmail.com](mailto:dot...@gmail.com)  
> > > > > > wrote:
> > > > > > 
> > > > > > > Is there a way to set max\_merged\_segment (or any of the merge  
> > > > > > > settings) at startup?
> > 
> > > > > > > I can set max\_merged\_segment dynamically like this and it works  
> > > > > > > as  
> > > > > > > expected:
> > 
> > > > > > > curl -XPUT localhost:9200/myindex/\_settings -d '{  
> > > > > > > "index" : {  
> > > > > > > "merge.policy.max\_merged\_segment" : "2g"  
> > > > > > > }  
> > > > > > > }'
> > 
> > > > > > > What I would like to do is set these for all indexes by default  
> > > > > > > at  
> > > > > > > startup, but this does not set it:
> > 
> > > > > > > index:  
> > > > > > > number\_of\_shards: 1  
> > > > > > > number\_of\_replicas: 0  
> > > > > > > merge.policy.max\_merged\_segment: 2g
> > 
> > > > > > > This does not work either:
> > 
> > > > > > > index:  
> > > > > > > number\_of\_shards: 1  
> > > > > > > number\_of\_replicas: 0
> > 
> > > > > > > ```
> > > > > > > merge:
> > > > > > > policy:
> > > > > > > max_merged_segment: 2g
> > > > > > > 
> > > > > > > ```
> > 
> > > > > > > I have also tried substituting "max\_merge\_size" for  
> > > > > > > "max\_merged\_segment".

---

<div class="post-metadata">

### Author: ![Huy\_Le](https://avatars.discourse-cdn.com/v4/letter/h/f17d59/32.png) [@Huy\_Le](https://discuss.elastic.co/u/Huy_Le)
#### Post date: [September 23, 2011, 4:48pm UTC](https://discuss.elastic.co/t/how-to-set-max-merged-segment-at-startup/5246/10 "2011-09-23T16:48:45Z")

</div>

Will do index close/open approach for changing settings.

Regarding master. I thought there was single master too. But then I  
saw a thread some where saying there were more than 1 master. Thanks  
for clarification.

Huy

On Sep 23, 10:07 am, Shay Banon [kim...@gmail.com](mailto:kim...@gmail.com) wrote:

> Closing the index will cause search to not work, but thats the only way to  
> change the merge policy _type_.
> 
> I think you misunderstand how elasticsearch works. In a cluster, there will  
> be a single master.
> 
> On Thu, Sep 22, 2011 at 8:28 PM, Huy Le [hu...@leveragingit.com](mailto:hu...@leveragingit.com) wrote:
> 
> > The files are under max\_merged\_segment.
> 
> > By closing the index, wouldn't that prevent searching from working?
> 
> > Alternatively, if we have more than 1 master, if we change config in  
> > master 1, restart master 1, and change config in master 2 and restart  
> > master, then restart the rest of cluster, would that work? Related  
> > question, what is the procedure to changing a cluster from single  
> > master to more than one master?
> 
> > Thanks!
> 
> > Huy
> 
> > On Sep 20, 10:28 am, Shay Banon [kim...@gmail.com](mailto:kim...@gmail.com) wrote:
> > 
> > > Interesting... . Those should be merged, unless they are above the  
> > > max\_merged\_segment parameter, is that the case?
> 
> > > I pointed to before, just want to make sure though. You can change the  
> > > merge  
> > > policy type by closing the index, using update settings to change the  
> > > merge  
> > > policy type setting, and open the index again.
> 
> > > On Tue, Sep 20, 2011 at 3:27 PM, Huy Le [hu...@leveragingit.com](mailto:hu...@leveragingit.com) wrote:
> > > 
> > > > We have solr with acceptable performance with log\_byte\_size merge  
> > > > policy. We would like to try a fast track to acceptable performance  
> > > > on ES cluster by setting merge policy on ES to the same setting we  
> > > > currently on our solr cluster. The issue we are experiencing is that  
> > > > there are so many (over 100) small segment files per shard on a 30-  
> > > > shard cluster that cause ES to spend too much CPU time on merging.
> 
> > > > Huy
> 
> > > > On Sep 20, 4:29 am, Shay Banon [kim...@gmail.com](mailto:kim...@gmail.com) wrote:
> > > > 
> > > > > There isn't an option to change the merge policy _type_ without  
> > > > > either  
> > > > > changing it in the settings and restarting the cluster. Or, closing  
> > > > > hte  
> > > > > index, updating the merge policy type, and opening it again. Why do  
> > > > > you  
> > > > > want  
> > > > > to change the type?
> 
> > > > > On Tue, Sep 20, 2011 at 5:52 AM, Huy Le [hu...@leveragingit.com](mailto:hu...@leveragingit.com)  
> > > > > wrote:
> > > > > 
> > > > > > Anyway to change merge policy (from tiered to log\_byte\_size)  
> > > > > > without  
> > > > > > downtime? Our production cluster currently have single master.  
> > > > > > If  
> > > > > > configuration in file is only taken on startup of master node, we  
> > > > > > won't be able to get this configuration to be read by the master on  
> > > > > > a  
> > > > > > single master node as when the master is leaving the cluster, a new  
> > > > > > node is promoted to be the new master.
> 
> > > > > > Thanks!
> 
> > > > > > Huy
> 
> > > > > > On Aug 26, 10:14 am, Shay Banon [kim...@gmail.com](mailto:kim...@gmail.com) wrote:
> > > > > > 
> > > > > > > When you set it in the configuration file, then it will be  
> > > > > > > applied if  
> > > > > > > that  
> > > > > > > node is the master, and the index gets created. You can also  
> > > > > > > specify  
> > > > > > > the  
> > > > > > > same setting when you create the index as an index setting.
> 
> > > > > > > I see where the problem is..., in the configuration level on  
> > > > > > > startup,  
> > > > > > > the  
> > > > > > > setting is misnamed, can called: max\_merge\_segment (merge instead  
> > > > > > > of  
> > > > > > > merged), I will fix that.
> 
> > > > > > > On Thu, Aug 25, 2011 at 3:01 AM, Tom Le [dot...@gmail.com](mailto:dot...@gmail.com)  
> > > > > > > wrote:
> > > > > > > 
> > > > > > > > Is there a way to set max\_merged\_segment (or any of the merge  
> > > > > > > > settings) at startup?
> 
> > > > > > > > I can set max\_merged\_segment dynamically like this and it works  
> > > > > > > > as  
> > > > > > > > expected:
> 
> > > > > > > > curl -XPUT localhost:9200/myindex/\_settings -d '{  
> > > > > > > > "index" : {  
> > > > > > > > "merge.policy.max\_merged\_segment" : "2g"  
> > > > > > > > }  
> > > > > > > > }'
> 
> > > > > > > > What I would like to do is set these for all indexes by default  
> > > > > > > > at  
> > > > > > > > startup, but this does not set it:
> 
> > > > > > > > index:  
> > > > > > > > number\_of\_shards: 1  
> > > > > > > > number\_of\_replicas: 0  
> > > > > > > > merge.policy.max\_merged\_segment: 2g
> 
> > > > > > > > This does not work either:
> 
> > > > > > > > index:  
> > > > > > > > number\_of\_shards: 1  
> > > > > > > > number\_of\_replicas: 0
> 
> > > > > > > > ```
> > > > > > > > merge:
> > > > > > > > policy:
> > > > > > > > max_merged_segment: 2g
> > > > > > > > 
> > > > > > > > ```
> 
> > > > > > > > I have also tried substituting "max\_merge\_size" for  
> > > > > > > > "max\_merged\_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: [July 6, 2017, 3:53am UTC](https://discuss.elastic.co/t/how-to-set-max-merged-segment-at-startup/5246/11 "2017-07-06T03:53:41Z")

</div>


