Create or update a lifecycle policy

Auth

If the specified policy exists, it is replaced and the policy version is incremented.

Note

Only the latest version of the policy is stored, you cannot revert to previous versions.

About index lifecycle management

Required authorization

Index privileges manage
Cluster privileges manage_ilm

Path parameters

policy string required

Identifier for the policy.

Query parameters

master_timeout string · default: 30s

Period to wait for a connection to the master node. If no response is received before the timeout expires, the request fails and returns an error.

timeout string · default: 30s

Period to wait for a response. If no response is received before the timeout expires, the request fails and returns an error.

Request body

policy object
phases object required
cold object
actions object
allocate object

Phases allowed: warm, cold.

number_of_replicas number
total_shards_per_node number
include map string to string
exclude map string to string
require map string to string
delete object

Phases allowed: delete.

delete_searchable_snapshot boolean
downsample object

Phases allowed: hot, warm, cold.

fixed_interval string required
wait_timeout string
freeze object deprecated

The freeze action is a noop in 8.x

forcemerge object

Phases allowed: hot, warm.

max_num_segments number required
index_codec string
migrate object

Phases allowed: warm, cold.

enabled boolean
readonly object

Phases allowed: hot, warm, cold.

rollover object

Phases allowed: hot.

max_size number | string deprecated

The max_size condition has been deprecated in 9.3.0 and max_primary_shard_size should be used instead

max_primary_shard_size number | string
max_age string
max_docs number
max_primary_shard_docs number
min_size number | string
min_primary_shard_size number | string
min_age string
min_docs number
min_primary_shard_docs number
set_priority object

Phases allowed: hot, warm, cold.

priority number
searchable_snapshot object

Phases allowed: hot, cold, frozen.

snapshot_repository string required
force_merge_index boolean
shrink object

Phases allowed: hot, warm.

number_of_shards number
max_primary_shard_size number | string
allow_write_after_shrink boolean
unfollow object

Phases allowed: hot, warm, cold, frozen.

wait_for_snapshot object

Phases allowed: delete.

policy string required
min_age string
delete object
Same fields as cold in phases
frozen object
Same fields as cold in phases
hot object
Same fields as cold in phases
warm object
Same fields as cold in phases
_meta object

Arbitrary metadata that is not automatically generated or used by Elasticsearch.

Response

application/json
acknowledged boolean required

For a successful response, this value is always true. On failure, an exception is returned instead.