# How to explicitly trigger /disable merge process?

**URL:** <https://discuss.elastic.co/t/how-to-explicitly-trigger-disable-merge-process/23959>\
**Category:** Elasticsearch\
**Created:** [June 19, 2015, 2:49am UTC](https://discuss.elastic.co/t/how-to-explicitly-trigger-disable-merge-process/23959 "2015-06-19T02:49:30Z")\
**Posts on this page:** 10\
**Page:** 1

<div class="post-metadata">

**Author:** ![bvnagaraju](https://avatars.discourse-cdn.com/v4/letter/b/ed655f/32.png) [@bvnagaraju](https://discuss.elastic.co/u/bvnagaraju)\
**Post date:** [June 19, 2015, 2:49am UTC](https://discuss.elastic.co/t/how-to-explicitly-trigger-disable-merge-process/23959/1 "2015-06-19T02:49:30Z")

</div>

Hi,

how to explicitly trigger /disable merge process ?

---

<div class="post-metadata">

**Author:** ![Joshua\_Rich](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/joshua_rich/32/44953_2.png) [@Joshua\_Rich](https://discuss.elastic.co/u/Joshua_Rich)\
**Post date:** [June 19, 2015, 6:48am UTC](https://discuss.elastic.co/t/how-to-explicitly-trigger-disable-merge-process/23959/2 "2015-06-19T06:48:32Z")

</div>

You can't completely disable the merge process and you wouldn't want to anyway. Merging, although an expensive operation, helps keep your segment counts and sizes constrained which if not checked would cause you worse performance issues than the merge process itself.

There are a [number of settings](https://www.elastic.co/guide/en/elasticsearch/reference/current/index-modules-merge.html) you can use to change the merge process, but we generally do not recommend changing these. You can explicitly force a merge with the [optimize](https://www.elastic.co/guide/en/elasticsearch/reference/current/indices-optimize.html) API endpoint (some of the merge settings do not apply to the optimize call).

What's the problem you are trying to solve here? There might be a better way to help than trying to "tune" merging.

---

<div class="post-metadata">

**Author:** ![bvnagaraju](https://avatars.discourse-cdn.com/v4/letter/b/ed655f/32.png) [@bvnagaraju](https://discuss.elastic.co/u/bvnagaraju)\
**Post date:** [June 19, 2015, 9:33am UTC](https://discuss.elastic.co/t/how-to-explicitly-trigger-disable-merge-process/23959/3 "2015-06-19T09:33:48Z")

</div>

I dont mean to say I want to disable completely disable merge .

As per my understanding and reading, I want to disable merge before large ingestion /updates starts and enable it back when large ingestion /updates are done .This way I can give my entire disk to ingestion /updates .From marvel what I found is ingestion /update speed slows down as soon as merge starts and also merge consume majority of the memory

---

<div class="post-metadata">

**Author:** ![Joshua\_Rich](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/joshua_rich/32/44953_2.png) [@Joshua\_Rich](https://discuss.elastic.co/u/Joshua_Rich)\
**Post date:** [June 23, 2015, 6:35am UTC](https://discuss.elastic.co/t/how-to-explicitly-trigger-disable-merge-process/23959/4 "2015-06-23T06:35:56Z")

</div>

Rather than changing the merging settings, I would suggest you look at any or all of the following:

- Use the bulk api through whatever client you are using and tune it for optimum performance. This usually significantly improves indexing rates.
- Increase `index.refresh_interval` at the cost of having more stale search results.

---

<div class="post-metadata">

**Author:** ![Jason\_Wee](https://avatars.discourse-cdn.com/v4/letter/j/7ea924/32.png) [@Jason\_Wee](https://discuss.elastic.co/u/Jason_Wee)\
**Post date:** [June 24, 2015, 6:15am UTC](https://discuss.elastic.co/t/how-to-explicitly-trigger-disable-merge-process/23959/5 "2015-06-24T06:15:52Z")

</div>

> [@Joshua\_Rich](#):
>
> You can explicitly force a merge with the optimize API endpoint (some of the merge settings do not apply to the optimize call).

well, i tried to call optimize api before, but the segment stay the same even after a while. any idea why?

---

<div class="post-metadata">

**Author:** ![Joshua\_Rich](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/joshua_rich/32/44953_2.png) [@Joshua\_Rich](https://discuss.elastic.co/u/Joshua_Rich)\
**Post date:** [June 24, 2015, 7:53am UTC](https://discuss.elastic.co/t/how-to-explicitly-trigger-disable-merge-process/23959/6 "2015-06-24T07:53:33Z")

</div>

Note the optimise call is blocking, it can take a long time to complete. My suggestion would be to try explicitly setting the `max_num_segments` parameter and performing an optimise on a single index to observe if it makes a difference:

```auto
curl -XPOST 'http://localhost:9200/someindex/_optimize?max_num_segments=2'

```

---

<div class="post-metadata">

**Author:** ![Jason\_Wee](https://avatars.discourse-cdn.com/v4/letter/j/7ea924/32.png) [@Jason\_Wee](https://discuss.elastic.co/u/Jason_Wee)\
**Post date:** [June 24, 2015, 8:06am UTC](https://discuss.elastic.co/t/how-to-explicitly-trigger-disable-merge-process/23959/7 "2015-06-24T08:06:57Z")

</div>

i tried it, current segment was around a thousand and with max\_num\_segments to 900, after the curl is complete, it is still showing around a thousand.

---

<div class="post-metadata">

**Author:** ![Joshua\_Rich](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/joshua_rich/32/44953_2.png) [@Joshua\_Rich](https://discuss.elastic.co/u/Joshua_Rich)\
**Post date:** [June 26, 2015, 7:04am UTC](https://discuss.elastic.co/t/how-to-explicitly-trigger-disable-merge-process/23959/8 "2015-06-26T07:04:16Z")

</div>

Is that per index or over your entire cluster? It seems like an awful lot...

---

<div class="post-metadata">

**Author:** ![Jason\_Wee](https://avatars.discourse-cdn.com/v4/letter/j/7ea924/32.png) [@Jason\_Wee](https://discuss.elastic.co/u/Jason_Wee)\
**Post date:** [June 29, 2015, 2:06pm UTC](https://discuss.elastic.co/t/how-to-explicitly-trigger-disable-merge-process/23959/9 "2015-06-29T14:06:40Z")

</div>

yea i know... have to really find way to reduce the segment count. thanks anyway

---

<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, 12:04am UTC](https://discuss.elastic.co/t/how-to-explicitly-trigger-disable-merge-process/23959/10 "2017-07-06T00:04:46Z")

</div>


