elasticsearch/docs/reference/ilm/apis/remove-policy-from-index.asciidoc
2024-12-31 20:21:46 +00:00

106 lines
2.5 KiB
Text

[role="xpack"]
[[ilm-remove-policy]]
=== Remove policy from index API
++++
<titleabbrev>Remove policy</titleabbrev>
++++
.New API reference
[sidebar]
--
For the most up-to-date API details, refer to {api-es}/group/endpoint-ilm[{ilm-cap} APIs].
--
Removes assigned <<index-lifecycle-management,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-ref-dir}/rest-api/common-parms.asciidoc[tag=master-timeout]
[[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" : []
}
--------------------------------------------------