Create or update a lifecycle policy
- PUT /_ilm/policy/{policy}
If the specified policy exists, it is replaced and the policy version is incremented.
Only the latest version of the policy is stored, you cannot revert to previous versions.
Required privileges
- Index privileges manage
- Cluster privileges manage_ilm
Request body
-
policyobject -
phasesobjectrequired -
coldobject -
actionsobject -
searchable_snapshotobject -
Phases allowed: hot, cold, frozen.
-
force_merge_on_cloneboolean · default: true -
If
true, and the index has replicas, ILM first clones the index with zero replicas and force merges the clone, so that replicas are not merged redundantly. Iffalse, the managed index is force merged directly. Not allowed whenforce_merge_indexisfalse. -
total_shards_per_nodenumber -
The maximum number of shards, including primaries and replicas, that can be allocated to any single node for the mounted index. Must be at least 1.
-
replicate_forunion oneOf -
The period for which the mounted index keeps one replica before the replica is removed. By default, the index is mounted without replicas. Must be positive. Only the first
searchable_snapshotaction in a policy may set this. It must fit before the next phase starts: for example, if this phase has amin_ageof 5d and the next phase has 12d, it can be at most 7d. -
Values:
-10 -
deleteobject -
Same fields as
coldinphases -
frozenobject -
Same fields as
coldinphases -
hotobject -
Same fields as
coldinphases -
warmobject -
Same fields as
coldinphases