Derrops
Derrops

Reputation: 8127

How to apply lifecycle patters in AWS elasticsearch to many indexs

I am trying to do this in AWS elasticsearch, whereby I create a template for the pattern application-logs-*, and then I want to apply a index policy log-rotation-policy for all indexes which match that expression. I have created my policy successfully, but when I try to create a template like so:

PUT _template/application-logs
{
  "index_patterns" : [
      "application-logs-*"
    ],
    "settings" : {
      "index.lifecycle.name": "log-rotation-policy", 
    }
}

I get an error:

    "type": "illegal_argument_exception",
    "reason": "unknown setting [index.policy_id] please check that any required plugins are installed, or check the breaking changes documentation for removed settings"

The AWS documentation is extremely vague,

Upvotes: 1

Views: 849

Answers (1)

Derrops
Derrops

Reputation: 8127

Ok sorry I thought I would post this answer anyway because as I was writing this I figured out the problem, the correct key o use is: opendistro.index_state_management.policy_id so it should be:

PUT _template/application-logs
{
  "index_patterns" : [
      "application-logs-*"
    ],
    "settings" : {
      "opendistro.index_state_management.policy_id": "log-rotation-policy", 
    }
}

I found the answer here.

Upvotes: 1

Related Questions