OpenSearch/docs/reference/ilm/apis/delete-lifecycle.asciidoc

90 lines
2.0 KiB
Plaintext
Raw Normal View History

[role="xpack"]
[testenv="basic"]
[[ilm-delete-lifecycle]]
2018-12-20 13:23:28 -05:00
=== Delete lifecycle policy API
++++
2018-12-20 13:23:28 -05:00
<titleabbrev>Delete policy</titleabbrev>
++++
Deletes a lifecycle policy.
2019-11-20 11:19:33 -05:00
[[ilm-delete-lifecycle-request]]
==== {api-request-title}
`DELETE _ilm/policy/<policy_id>`
2019-11-20 11:19:33 -05:00
[[ilm-delete-lifecycle-prereqs]]
==== {api-prereq-title}
* If the {es} {security-features} are enabled, you must have the `manage_ilm`
cluster privilege to use this API. For more information, see
<<security-privileges>>.
[[ilm-delete-lifecycle-desc]]
==== {api-description-title}
Deletes the specified lifecycle policy definition. You cannot delete policies
that are currently in use. If the policy is being used to manage any indices,
the request fails and returns an error.
2019-11-20 11:19:33 -05:00
[[ilm-delete-lifecycle-path-params]]
==== {api-path-parms-title}
2019-11-20 11:19:33 -05:00
`<policy_id>`::
(Required, string) Identifier for the policy.
2019-11-20 11:19:33 -05:00
[[ilm-delete-lifecycle-query-params]]
==== {api-query-parms-title}
include::{docdir}/rest-api/common-parms.asciidoc[tag=timeoutparms]
2019-11-20 11:19:33 -05:00
[[ilm-delete-lifecycle-example]]
==== {api-examples-title}
The following example deletes `my_policy`:
//////////////////////////
[source,console]
--------------------------------------------------
PUT _ilm/policy/my_policy
{
"policy": {
"phases": {
"warm": {
"min_age": "10d",
"actions": {
"forcemerge": {
"max_num_segments": 1
}
}
},
"delete": {
"min_age": "30d",
"actions": {
"delete": {}
}
}
}
}
}
--------------------------------------------------
// TEST
//////////////////////////
[source,console]
--------------------------------------------------
DELETE _ilm/policy/my_policy
--------------------------------------------------
// TEST[continued]
When the policy is successfully deleted, you receive the following result:
[source,console-result]
--------------------------------------------------
{
"acknowledged": true
}
--------------------------------------------------