Force merge
Phases allowed: hot, warm.
Force merges the index into the specified maximum number of segments.
Shards that are relocating during a forcemerge will not be merged.
To use the forcemerge action in the hot phase, the rollover action must be present. If no rollover action is configured, ILM will reject the policy.
Options
-
max_num_segments - (Required, integer) Number of segments to merge to. To fully merge the index, set to
1. -
index_codec -
(Optional, string) Codec used to compress the document store. The only accepted value is
best_compression, which uses ZSTD for a higher compression ratio but slower stored fields performance. To use the default LZ4 codec, omit this argument.
Example
resp = client.ilm.put_lifecycle(
name="my_policy",
policy={
"phases": {
"warm": {
"actions": {
"forcemerge": {
"max_num_segments": 1
}
}
}
}
},
)
print(resp) response = client.ilm.put_lifecycle(
policy: 'my_policy',
body: {
policy: {
phases: {
warm: {
actions: {
forcemerge: {
max_num_segments: 1
}
}
}
}
}
}
)
puts response const response = await client.ilm.putLifecycle({
name: "my_policy",
policy: {
phases: {
warm: {
actions: {
forcemerge: {
max_num_segments: 1,
},
},
},
},
},
});
console.log(response); PUT _ilm/policy/my_policy
{
"policy": {
"phases": {
"warm": {
"actions": {
"forcemerge" : {
"max_num_segments": 1
}
}
}
}
}
}
© 2023-2025 Elasticsearch
As of September 2024, Elasticsearch is available under a choice of three licenses: the Server Side Public License (SSPL), the Elastic License, or the AGPLv3 (OSI approved).
Elasticsearch and the Elasticsearch logo are trademarks of Elasticsearch B.V., registered in the U.S. and in other countries.
https://www.elastic.co/guide/en/elasticsearch/reference/8.17/ilm-forcemerge.html