# ES 2.3.3 Force merge not merging?

**URL:** <https://discuss.elastic.co/t/es-2-3-3-force-merge-not-merging/66311>\
**Category:** Elasticsearch\
**Created:** [November 16, 2016, 9:56pm UTC](https://discuss.elastic.co/t/es-2-3-3-force-merge-not-merging/66311 "2016-11-16T21:56:22Z")\
**Posts on this page:** 12\
**Page:** 1

<div class="post-metadata">

**Author:** ![quid\_ryan](https://avatars.discourse-cdn.com/v4/letter/q/7ea924/32.png) [@quid\_ryan](https://discuss.elastic.co/u/quid_ryan)\
**Post date:** [November 16, 2016, 9:56pm UTC](https://discuss.elastic.co/t/es-2-3-3-force-merge-not-merging/66311/1 "2016-11-16T21:56:22Z")

</div>

Hi there,

Was wondering if I could get some clarity on the following issue:

We are using ES 2.3.3, and have some indices that are no longer being written into. We went ahead and executed a force merge on those indices setting the max number of segments to 1. The API returns a success, however nothing happens. Viewing the \_cat API we can confirm that the same number of segments exist post the merge.

Is my assumption that segments should equal 1 correct, or am I missing something.

Thanks in advance.

---

<div class="post-metadata">

**Author:** ![cheruvian](https://avatars.discourse-cdn.com/v4/letter/c/48db29/32.png) [@cheruvian](https://discuss.elastic.co/u/cheruvian)\
**Post date:** [November 16, 2016, 10:02pm UTC](https://discuss.elastic.co/t/es-2-3-3-force-merge-not-merging/66311/2 "2016-11-16T22:02:19Z")

</div>

Unfortunately we've seen that force merges can take hours to complete.

There also doesn't appear to be good progress or status tracking of the merge.

[I just posted about this here](https://discuss.elastic.co/t/force-merge-api-status/66020)

Another thing to watch out for is that apparently merges are not throttled and can consume many resources on a node which we have seen (ref: [https://www.elastic.co/guide/en/elasticsearch/guide/current/merge-process.html#CO41-1](https://www.elastic.co/guide/en/elasticsearch/guide/current/merge-process.html#CO41-1))

---

<div class="post-metadata">

**Author:** ![quid\_ryan](https://avatars.discourse-cdn.com/v4/letter/q/7ea924/32.png) [@quid\_ryan](https://discuss.elastic.co/u/quid_ryan)\
**Post date:** [November 16, 2016, 10:05pm UTC](https://discuss.elastic.co/t/es-2-3-3-force-merge-not-merging/66311/3 "2016-11-16T22:05:19Z")

</div>

Ah,

Thanks for the quick response. I did see your post, but didn't put two and two together (thought it was blocking) via the API.

Will check back in a bit on the cluster and see whats up.

Thanks

---

<div class="post-metadata">

**Author:** ![msimos](https://avatars.discourse-cdn.com/v4/letter/m/bb73d2/32.png) [@msimos](https://discuss.elastic.co/u/msimos)\
**Post date:** [November 16, 2016, 11:18pm UTC](https://discuss.elastic.co/t/es-2-3-3-force-merge-not-merging/66311/4 "2016-11-16T23:18:26Z")

</div>

Hi,

If you want to see if the force merge is running then execute:

```auto
GET _nodes/hot_threads

```

You'll see an output like:

```
1.0% (4.8ms out of 500ms) cpu usage by thread 'elasticsearch[es2-data1][force_merge][T#1]'
 10/10 snapshots sharing following 18 elements
   java.lang.Object.wait(Native Method)
   org.apache.lucene.index.IndexWriter.doWait(IndexWriter.java:4303)
   org.apache.lucene.index.IndexWriter.forceMerge(IndexWriter.java:1787)

```

If you don't see this running then its completed.

---

<div class="post-metadata">

**Author:** ![quid\_ryan](https://avatars.discourse-cdn.com/v4/letter/q/7ea924/32.png) [@quid\_ryan](https://discuss.elastic.co/u/quid_ryan)\
**Post date:** [November 17, 2016, 3:33am UTC](https://discuss.elastic.co/t/es-2-3-3-force-merge-not-merging/66311/5 "2016-11-17T03:33:56Z")

</div>

Would there be any reason a force merge completed, however I have more than one segment?

---

<div class="post-metadata">

**Author:** ![msimos](https://avatars.discourse-cdn.com/v4/letter/m/bb73d2/32.png) [@msimos](https://discuss.elastic.co/u/msimos)\
**Post date:** [November 17, 2016, 10:16pm UTC](https://discuss.elastic.co/t/es-2-3-3-force-merge-not-merging/66311/6 "2016-11-17T22:16:48Z")

</div>

Don't run a force merge on any index you currently or plan to write to. The index should be effectively "read only". If you run it on an index which your indexing to then its likely you'll end up with more segments.

---

<div class="post-metadata">

**Author:** ![quid\_ryan](https://avatars.discourse-cdn.com/v4/letter/q/7ea924/32.png) [@quid\_ryan](https://discuss.elastic.co/u/quid_ryan)\
**Post date:** [November 17, 2016, 10:59pm UTC](https://discuss.elastic.co/t/es-2-3-3-force-merge-not-merging/66311/7 "2016-11-17T22:59:58Z")

</div>

Mike,

Thanks for the reply. I can confirm I am no longer indexing into the index. I also checked the hot threads and don't ever see a thread for force\_merge. The fact that I do not have a single segment is still a bit head scratching.

---

<div class="post-metadata">

**Author:** ![msimos](https://avatars.discourse-cdn.com/v4/letter/m/bb73d2/32.png) [@msimos](https://discuss.elastic.co/u/msimos)\
**Post date:** [November 17, 2016, 11:16pm UTC](https://discuss.elastic.co/t/es-2-3-3-force-merge-not-merging/66311/8 "2016-11-17T23:16:30Z")

</div>

Hi,

Make sure you use:

POST /twitter/\_forcemerge?max\_num\_segments=1

---

<div class="post-metadata">

**Author:** ![agriffit](https://avatars.discourse-cdn.com/v4/letter/a/b77776/32.png) [@agriffit](https://discuss.elastic.co/u/agriffit)\
**Post date:** [November 25, 2016, 1:13pm UTC](https://discuss.elastic.co/t/es-2-3-3-force-merge-not-merging/66311/10 "2016-11-25T13:13:33Z")

</div>

I'm seeing the same behavior on 5.0.1. Despite setting max\_num\_segments=1 I end up with two segments.

---

<div class="post-metadata">

**Author:** ![quid\_ryan](https://avatars.discourse-cdn.com/v4/letter/q/7ea924/32.png) [@quid\_ryan](https://discuss.elastic.co/u/quid_ryan)\
**Post date:** [December 9, 2016, 12:31am UTC](https://discuss.elastic.co/t/es-2-3-3-force-merge-not-merging/66311/11 "2016-12-09T00:31:57Z")

</div>

How many shards in the index? It will merge the max\_num per shard.

---

<div class="post-metadata">

**Author:** ![quid\_ryan](https://avatars.discourse-cdn.com/v4/letter/q/7ea924/32.png) [@quid\_ryan](https://discuss.elastic.co/u/quid_ryan)\
**Post date:** [December 9, 2016, 12:33am UTC](https://discuss.elastic.co/t/es-2-3-3-force-merge-not-merging/66311/12 "2016-12-09T00:33:29Z")

</div>

Update:  
Thanks Mike, the issue was max\_num\_segments as a url param as opposed to a body param, which was using the default (bit misleading)

---

<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:** [January 6, 2017, 12:34am UTC](https://discuss.elastic.co/t/es-2-3-3-force-merge-not-merging/66311/13 "2017-01-06T00:34:10Z")

</div>

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