diff --git a/docs/im/ism/policies.md b/docs/im/ism/policies.md index 50c0e95c..9a75b7f2 100644 --- a/docs/im/ism/policies.md +++ b/docs/im/ism/policies.md @@ -523,70 +523,72 @@ You can use the same options for `ctx` variables as the [notification](#notifica The following sample template policy is for a rollover use case: -1. Create a policy with an `ism_template` field. +The following sample template policy is for a rollover use case. -```json -PUT _opensearch/_ism/policies/rollover_policy -{ - "policy": { - "description": "Example rollover policy.", - "default_state": "rollover", - "states": [ - { - "name": "rollover", - "actions": [ - { - "rollover": { - "min_doc_count": 1 - } - } - ], - "transitions": [] - } - ], - "ism_template": { - "index_patterns": ["log*"], - "priority": 100 - } - } -} -``` +1. Create a policy with an `ism_template` field: -You need to specify the `index_patterns` field. If you don't specify a value for `priority`, it defaults to 0. + ```json + PUT _opensearch/_ism/policies/rollover_policy + { + "policy": { + "description": "Example rollover policy.", + "default_state": "rollover", + "states": [ + { + "name": "rollover", + "actions": [ + { + "rollover": { + "min_doc_count": 1 + } + } + ], + "transitions": [] + } + ], + "ism_template": { + "index_patterns": ["log*"], + "priority": 100 + } + } + } + ``` -1. Set up a template with the `rollover_alias` as `log` : + You need to specify the `index_patterns` field. If you don't specify a value for `priority`, it defaults to 0. -```json -PUT _template/ism_rollover -{ - "index_patterns": ["log*"], - "settings": { - "opensearch.index_state_management.rollover_alias": "log" - } -} -``` +2. Set up a template with the `rollover_alias` as `log` : -1. Create an index with the `log` alias: + ```json + PUT _index_template/ism_rollover + { + "index_patterns": ["log*"], + "settings": { + "opensearch.index_state_management.rollover_alias": "log" + } + } + ``` -```json -PUT log-000001 -{ - "aliases": { - "log": { - "is_write_index": true - } - } -} -``` +3. Create an index with the `log` alias: -1. Index a document to trigger the rollover condition: + ```json + PUT log-000001 + { + "aliases": { + "log": { + "is_write_index": true + } + } + } + ``` -```json -POST log/_doc -{ - "message": "dummy" -} -``` +4. Index a document to trigger the rollover condition: + + ```json + POST log/_doc + { + "message": "dummy" + } + ``` ## Example policy