--
:api: ilm-put-lifecycle-policy
:request: PutLifecyclePolicyRequest
:response: AcknowledgedResponse
--
[role="xpack"]
[id="{upid}-{api}"]
=== Create or update lifecycle policy API


[id="{upid}-{api}-request"]
==== Request

Creates or updates an index lifecycle management policy.

["source","java",subs="attributes,callouts,macros"]
--------------------------------------------------
include-tagged::{doc-tests-file}[{api}-request]
--------------------------------------------------
<1> Adds a hot phase with a rollover action
<2> Adds a delete phase that will delete in the index 90 days after rollover
<3> Creates the policy with the defined phases and the name `my_policy`

[id="{upid}-{api}-response"]
==== Response

The +{response}+ indicates if the request was received.

["source","java",subs="attributes,callouts,macros"]
--------------------------------------------------
include-tagged::{doc-tests-file}[{api}-response]
--------------------------------------------------
<1> Whether or not the request was acknowledged.

include::../execution.asciidoc[]

