OpenSearch/docs/reference/ilm/apis/remove-policy-from-index.as...

104 lines
2.4 KiB
Plaintext

[role="xpack"]
[testenv="basic"]
[[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 index aliases to target.
Wildcard expressions (`*`) are supported.
+
To target all data streams and indices in a cluster, use `_all` or `*`.
[[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" : []
}
--------------------------------------------------