# Monitoring whether the index is merging at a moment

**URL:** <https://discuss.elastic.co/t/monitoring-whether-the-index-is-merging-at-a-moment/25206>\
**Category:** Elasticsearch\
**Created:** [July 9, 2015, 6:13am UTC](https://discuss.elastic.co/t/monitoring-whether-the-index-is-merging-at-a-moment/25206 "2015-07-09T06:13:28Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![Ilija\_Subasic1](https://avatars.discourse-cdn.com/v4/letter/i/ba9def/32.png) [@Ilija\_Subasic1](https://discuss.elastic.co/u/Ilija_Subasic1)\
**Post date:** [July 9, 2015, 6:13am UTC](https://discuss.elastic.co/t/monitoring-whether-the-index-is-merging-at-a-moment/25206/1 "2015-07-09T06:13:28Z")

</div>

Is the changes in number of segments per shard a good indication that merging happened (is happening)?  
Is there a way to monitor when merging happens. I am running some online indexing, and it looks like merging happens quite often.

I did curl -XGET '[http://localhost:9200/files/\_segments?pretty](http://localhost:9200/files/_segments?pretty)' | grep num\_search\_s  
several time back-to-back and got different results each time?  
[https://gist.github.com/ja-ilija/44c6a3093db39b9f9a3d](https://gist.github.com/ja-ilija/44c6a3093db39b9f9a3d)

Thanks,  
Ilija

---

<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:** [July 10, 2015, 4:08am UTC](https://discuss.elastic.co/t/monitoring-whether-the-index-is-merging-at-a-moment/25206/2 "2015-07-10T04:08:03Z")

</div>

That is a decent indicator, you could also try turning up logging for merges (I think you can do this).

Is this a problem or are you just interested?

---

<div class="post-metadata">

**Author:** ![Ilija\_Subasic1](https://avatars.discourse-cdn.com/v4/letter/i/ba9def/32.png) [@Ilija\_Subasic1](https://discuss.elastic.co/u/Ilija_Subasic1)\
**Post date:** [July 10, 2015, 6:31am UTC](https://discuss.elastic.co/t/monitoring-whether-the-index-is-merging-at-a-moment/25206/3 "2015-07-10T06:31:30Z")

</div>

Hi,  
Thanks for the answer. It is a problem that we are facing. We are indexing a rather large number of files (few hundreds a second) and our queries become somewhat slow as many threads a re created and pooled (profiling showed 40% of time is spent waiting for the available thread). Since we put the refresh rate to 1s we thought that indexing is taking a bunch of resources (and considers a bulk indexing approach). However, some of our tests showed our queries were not speeding up when indexing was truned off, so one of the suspects was that merging may be going on and that this is taking resources when indexing is off.

Will probably try to play around with trottle size to see what happens.

---

<div class="post-metadata">

**Author:** ![colings86](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/colings86/32/44960_2.png) [@colings86](https://discuss.elastic.co/u/colings86)\
**Post date:** [July 10, 2015, 8:06am UTC](https://discuss.elastic.co/t/monitoring-whether-the-index-is-merging-at-a-moment/25206/4 "2015-07-10T08:06:03Z")

</div>

Merging is triggered by indexing documents (unless explicitly called through the API). If you disabled your indexing then ES will not be performing merges either.

It might be worth looking at the [`hot_threads`](https://www.elastic.co/guide/en/elasticsearch/reference/current/cluster-nodes-hot-threads.html) output when you experience these problems to help determine what's causing the slow queries.

HTH

---

<div class="post-metadata">

**Author:** ![Ilija\_Subasic1](https://avatars.discourse-cdn.com/v4/letter/i/ba9def/32.png) [@Ilija\_Subasic1](https://discuss.elastic.co/u/Ilija_Subasic1)\
**Post date:** [July 10, 2015, 8:26am UTC](https://discuss.elastic.co/t/monitoring-whether-the-index-is-merging-at-a-moment/25206/5 "2015-07-10T08:26:12Z")

</div>

Thanks. What I think is happening is that the merging starts and is still  
going after the indexing is suspended. I'll check the hot\_threads to see  
what is happening.

2015-07-10 15:16 GMT+07:00 Colin Goodheart-Smithe \<  
noreply@discuss.elastic.co\>:

---

<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:02am UTC](https://discuss.elastic.co/t/monitoring-whether-the-index-is-merging-at-a-moment/25206/6 "2017-07-06T00:02:21Z")

</div>


