elasticsearch/docs/reference/ilm/apis/remove-policy-from-index.asciidoc
James Rodewig f56a0f4b66
[DOCS] Remove testenv annotations from doc snippet tests (#80023)
Removes `testenv` annotations and related code. These annotations originally let you skip x-pack snippet tests in the docs. However, that's no longer possible.

Relates to #79309, #31619
2021-11-05 18:38:50 -04:00

100 lines
2.3 KiB
Text

[role="xpack"]
[[ilm-remove-policy]]
=== Remove policy from index API
++++
<titleabbrev>Remove policy</titleabbrev>
++++
Removes assigned lifecycle policies from an index or a data stream's backing
indices.
[[ilm-remove-policy-request]]
==== {api-request-title}
`POST <target>/_ilm/remove`
[[ilm-remove-policy-prereqs]]
==== {api-prereq-title}
* If the {es} {security-features} are enabled, you must have the `manage_ilm`
privileges on the indices being managed to use this API. For more information,
see <<security-privileges>>.
[[ilm-remove-policy-desc]]
==== {api-description-title}
For indices, the remove lifecycle policy API removes the assigned lifecycle
policy and stops managing the specified index.
For data streams, the API removes any assigned lifecycle policies from
the stream's backing indices and stops managing the indices.
[[ilm-remove-policy-path-params]]
==== {api-path-parms-title}
`<target>`::
(Required, string) Comma-separated list of data streams, indices, and aliases to
target. Supports wildcards (`*`). To target all data streams and indices, use
`*` or `_all`.
[[ilm-remove-policy-query-params]]
==== {api-query-parms-title}
include::{es-repo-dir}/rest-api/common-parms.asciidoc[tag=timeoutparms]
[[ilm-remove-policy-example]]
==== {api-examples-title}
The following example removes the assigned policy from `my-index-000001`.
//////////////////////////
[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": {}
}
}
}
}
}
PUT my-index-000001
{
"settings": {
"index.lifecycle.name": "my_policy"
}
}
--------------------------------------------------
//////////////////////////
[source,console]
--------------------------------------------------
POST my-index-000001/_ilm/remove
--------------------------------------------------
// TEST[continued]
If the request succeeds, you receive the following result:
[source,console-result]
--------------------------------------------------
{
"has_failures" : false,
"failed_indexes" : []
}
--------------------------------------------------