Add an ISM to All Elasticsearch index matching selected index patterns (* to match all patterns).
ISM sets number of replicas to 0 after 7 days and then deletes the index after 14.
Created
November 1, 2021 08:57
-
-
Save apr-1985/5e6aed7727ec9f212eca62d3f80fa437 to your computer and use it in GitHub Desktop.
Adding an ISM to Elasticsearch
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| curl -XPUT 'https://<YOUR_URL>/_template/14_day_delete' -H 'Content-Type: application/json' -d '{"index_patterns": ["artifactory-*", "github-*", "lambda-*"], "settings": {"opendistro.index_state_management.policy_id": "delete_after_14d"}}' |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| { | |
| "policy": { | |
| "policy_id": "delete_after_14d", | |
| "description": "Changes replica count and deletes.", | |
| "last_updated_time": 1614070452118, | |
| "schema_version": 1, | |
| "error_notification": null, | |
| "default_state": "current", | |
| "states": [ | |
| { | |
| "name": "current", | |
| "actions": [], | |
| "transitions": [ | |
| { | |
| "state_name": "old", | |
| "conditions": { | |
| "min_index_age": "7d" | |
| } | |
| } | |
| ] | |
| }, | |
| { | |
| "name": "old", | |
| "actions": [ | |
| { | |
| "replica_count": { | |
| "number_of_replicas": 0 | |
| } | |
| } | |
| ], | |
| "transitions": [ | |
| { | |
| "state_name": "delete", | |
| "conditions": { | |
| "min_index_age": "14d" | |
| } | |
| } | |
| ] | |
| }, | |
| { | |
| "name": "delete", | |
| "actions": [ | |
| { | |
| "delete": {} | |
| } | |
| ], | |
| "transitions": [] | |
| } | |
| ] | |
| } | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment