Manually port policy changes
This commit is contained in:
parent
16fc67535c
commit
32165a4ccd
|
@ -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:
|
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
|
1. Create a policy with an `ism_template` field:
|
||||||
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
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
```
|
|
||||||
|
|
||||||
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
|
2. Set up a template with the `rollover_alias` as `log` :
|
||||||
PUT _template/ism_rollover
|
|
||||||
{
|
|
||||||
"index_patterns": ["log*"],
|
|
||||||
"settings": {
|
|
||||||
"opensearch.index_state_management.rollover_alias": "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
|
3. Create an index with the `log` alias:
|
||||||
PUT log-000001
|
|
||||||
{
|
|
||||||
"aliases": {
|
|
||||||
"log": {
|
|
||||||
"is_write_index": true
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
```
|
|
||||||
|
|
||||||
1. Index a document to trigger the rollover condition:
|
```json
|
||||||
|
PUT log-000001
|
||||||
|
{
|
||||||
|
"aliases": {
|
||||||
|
"log": {
|
||||||
|
"is_write_index": true
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
```
|
||||||
|
|
||||||
```json
|
4. Index a document to trigger the rollover condition:
|
||||||
POST log/_doc
|
|
||||||
{
|
```json
|
||||||
"message": "dummy"
|
POST log/_doc
|
||||||
}
|
{
|
||||||
```
|
"message": "dummy"
|
||||||
|
}
|
||||||
|
```
|
||||||
|
|
||||||
## Example policy
|
## Example policy
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue