Update Policy issues & question

I updated my ism policy and wanted it to be applied to existing index which is mapped to same policy but to previous “policy_seq_no”.

I did POST _opendistro/_ism/change_policy/index-id
with request body:
{
“policy_id”: “policy-name”,
“state”: “warm”
}
but I don’t see anything happening with index. I checked in .opendistro-ism-config for index and I see
“change_policy”: {
“policy_id”: “policy-name”,
“state”: “warm”,
“is_safe”: false
}
what does this mean? what is “is_safe” ?
Is it possible to update existing index with same policy but to different “policy_seq_no”?

Hi @arifibrahim4,

Yes, you can update the policy with an updated version of the same policy.
To briefly explain how the change policy API works:

  • When you apply a policy to an index, it takes a snapshot of that policy and saves it on the job so any further modifications to the policy does not interrupt existing jobs.
  • When you want to update the policy and apply it to an index using the policy you will use the Change Policy API, perfectly fine to use the same policy_id.
  • Our current logic is to wait for the state to be done executing all actions before allowing a Change Policy to occur otherwise you could end up in weird situations.
  • This unfortunately didn’t handle common situations like “I used the wrong value in Rollover and now it’s stuck forever”. So one more thing it does is compare your old policy versus the new policy and if the current state of the managed index is the same, it has the same actions in the same order, and the only thing that changed was some configuration values then we deem it to be “safe” to immediately change the policy even before it reaches the end of the state.

So I’m guessing from your description that you changed your policy enough that it is waiting for the end of the current state before allowing the change to happen.

Also the change is asynchronous and happens in place of the normal executions that happen on an interval. So in ODFE it is by default 5 minutes which would explain a delay from seeing the change happen.

1 Like