OpenSearch/docs/reference/ilm/actions/ilm-forcemerge.asciidoc
Andrei Dan 235e5ed3ea
[7.x] ILM: add force-merge step to searchable snapshots action (#60819) (#60882)
This adds a force-merge step to the searchable snapshot action, enabled by default,
but parameterizable using the `force_merge-index" optional boolean.

eg.
```
PUT _ilm/policy/my_policy
{
  "policy": {
    "phases": {
      "cold": {
        "actions": {
          "searchable_snapshot" : {
            "snapshot_repository" : "backing_repo",
            "force_merge_index": true
          }
        }
      }
    }
  }
}
```

(cherry picked from commit d0a17b2d35f1b083b574246bdbf3e1929471a4a9)
Signed-off-by: Andrei Dan <andrei.dan@elastic.co>
2020-08-10 13:45:11 +01:00

57 lines
1.5 KiB
Plaintext

[role="xpack"]
[[ilm-forcemerge]]
=== Force merge
Phases allowed: hot, warm.
<<indices-forcemerge,Force merges>> the index into
the specified maximum number of <<indices-segments,segments>>.
This action makes the index <<dynamic-index-settings,read-only>>.
To use the `forcemerge` action in the `hot` phase, the `rollover` action *must* be present.
If no rollover action is configured, {ilm-init} will reject the policy.
[NOTE]
The `forcemerge` action is best effort. It might happen that some of the
shards are relocating, in which case they will not be merged.
[[ilm-forcemerge-options]]
==== Options
`max_num_segments`::
(Required, integer)
Number of segments to merge to. To fully merge the index, set to `1`.
`codec`::
(Optional, string)
Use the `best_compression` codec. Valid values: `best_compression`.
+
[WARNING]
======
Setting `"codec": "best_compression"` in the {ilm-init} forcemerge action causes {ilm-int} to
<<indices-close,close>> and then <<indices-open-close,re-open>> the index prior to the force merge.
During this time, the index is unavailable for both read and write operations.
======
[[ilm-forcemerge-action-ex]]
==== Example
[source,console]
--------------------------------------------------
PUT _ilm/policy/my_policy
{
"policy": {
"phases": {
"warm": {
"actions": {
"forcemerge" : {
"max_num_segments": 1
}
}
}
}
}
}
--------------------------------------------------