# Curator forcemerge Exception

**URL:** <https://discuss.elastic.co/t/curator-forcemerge-exception/354245>\
**Category:** Elasticsearch\
**Tags:** curator\
**Created:** [February 27, 2024, 2:45pm UTC](https://discuss.elastic.co/t/curator-forcemerge-exception/354245 "2024-02-27T14:45:33Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![Daniel314](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/daniel314/32/21668_2.png) [@Daniel314](https://discuss.elastic.co/u/Daniel314)\
**Post date:** [February 27, 2024, 2:45pm UTC](https://discuss.elastic.co/t/curator-forcemerge-exception/354245/1 "2024-02-27T14:45:33Z")

</div>

Hi,

I have an Elastic cluster running version 8.12.x with curator\_cli version 8.0.10.  
I recently had an odd timeout/connect issue with curator\_cli while it was doing a forcemerge (scheduled script -- not the focus of this post), so when I noticed the issue I manually re-ran the command (forcemerge), and it errored out with a very generic exception.

After some digging, it appears to be a variant of [this](https://github.com/elastic/curator/issues/1245) issue (curator\_cli throws an error because the specified index segments are already at/below the specified number of segments, even though --ignore\_empty\_list has been specified). However, now the error seems even more obfuscated (plus the script exits with a non-zero exit code). When running in debug mode, here are the last two lines of output:

```auto
2024-02-27 07:37:18,632 DEBUG curator.indexlist empty_list_check:400 Checking for empty list
2024-02-27 07:37:18,632 CRITICAL curator.cli_singletons.cli_action.forcemerge do_singleton_action:224 Failed to complete action: forcemerge. <class 'Exception'>:

```

Ideally, curator\_cli forcemerge would silently ignore any index at/below the specified number of segments. However, if the curator\_cli error isn't going to be suppressed, could the error message at least be more specific about what the error is?

Thanks,

```
 - Daniel

```

---

<div class="post-metadata">

**Author:** ![theuntergeek](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/theuntergeek/32/44961_2.png) [@theuntergeek](https://discuss.elastic.co/u/theuntergeek)\
**Post date:** [February 27, 2024, 4:20pm UTC](https://discuss.elastic.co/t/curator-forcemerge-exception/354245/2 "2024-02-27T16:20:08Z")

</div>

This should be a feature request at GitHub, if that's something worth pursuing.

One of the other issues that this may be is that force merges once started cannot be canceled. If you immediately restarted Curator and the force merge in question was still ongoing, it is possible that the error is related to this phenomenon. I'm not in front of the code base at the moment, but I believe it would be trivial to check for the expected number of segments and send an INFO log level that it is already at that level, _if it doesn't already do this._

---

<div class="post-metadata">

**Author:** ![Daniel314](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/daniel314/32/21668_2.png) [@Daniel314](https://discuss.elastic.co/u/Daniel314)\
**Post date:** [February 27, 2024, 4:52pm UTC](https://discuss.elastic.co/t/curator-forcemerge-exception/354245/3 "2024-02-27T16:52:23Z")

</div>

The 8.0.10 version of curator\_cli doesn't output an INFO-level message about already being at/below the requested number segments. I'll add a feature request on the GitHub site -- thanks.

In my case, there wasn't any other forcemerge going on. If I pick on other indices from prior forcemerges that are already at one segment per shard, I receive the same generic exception error. Here's an example of that:

```auto
$ curator_cli --version
curator_cli, version 8.0.10
$ curl -sS -XGET http://localhost:9200/myindex-2024.02.23/_segments | jq '[.. | .shards? // empty | to_entries[] | { "key":"shard \(.key)", "value":.value[0].num_committed_segments }] | flatten | from_entries'
{
  "shard 0": 1,
  "shard 1": 1
}
$ curator_cli --loglevel INFO --request_timeout 14400 forcemerge --ignore_empty_list --max_num_segments 1 --filter_list '[{"filtertype":"pattern","kind":"prefix","value":"myindex-2024.02.23"}]'
Using default configuration file at /.../.curator/curator.yml
2024-02-27 09:43:17,889 CRITICAL Failed to complete action: forcemerge. <class 'Exception'>:

```

---

<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:** [March 26, 2024, 4:52pm UTC](https://discuss.elastic.co/t/curator-forcemerge-exception/354245/4 "2024-03-26T16:52:38Z")

</div>

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