Create lifecycle policy API
editCreate lifecycle policy API
editThis functionality is in beta and is subject to change. The design and code is less mature than official GA features and is being provided as-is with no warranties. Beta features are not subject to the support SLA of official GA features.
Creates or updates lifecycle policy. See Policy phases and actions for definitions of policy components.
Request
editPUT _ilm/policy/<policy_id>
Description
editCreates a lifecycle policy. If the specified policy exists, the policy is replaced and the policy version is incremented.
Only the latest version of the policy is stored, you cannot revert to previous versions.
Path Parameters
edit-
policy
(required) - (string) Identifier for the policy.
Request Parameters
edit-
timeout
-
(time units) Specifies the period of time to wait for a response. If no
response is received before the timeout expires, the request fails and
returns an error. Defaults to
30s
. For more information about time units, see Time units. -
master_timeout
-
(time units) Specifies the period of time 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. Defaults to
30s
. For more information about time units, see Time units.
Authorization
editYou must have the manage_ilm
cluster privilege to use this API. You must
also have the manage
index privilege on all indices being managed by policy
.
All operations executed by index lifecycle management for a policy are executed as the user that
put the latest version of a policy.
For more information, see Security Privileges.
Examples
editThe following example creates a new policy named my_policy
:
PUT _ilm/policy/my_policy { "policy": { "phases": { "warm": { "min_age": "10d", "actions": { "forcemerge": { "max_num_segments": 1 } } }, "delete": { "min_age": "30d", "actions": { "delete": {} } } } } }
If the request succeeds, you receive the following result:
{ "acknowledged": true }