Updates to policies not managing indices

edit

Indices not referencing an existing policy that is updated will not be affected. If an index is assigned to the policy, it will be assigned the latest version of that policy

To show this, let’s create a policy my_policy.

PUT _ilm/policy/my_policy
{
  "policy": {
    "phases": {
      "hot": {
        "actions": {
          "rollover": {
            "max_size": "25GB"
          }
        }
      },
      "delete": {
        "min_age": "30d",
        "actions": {
          "delete": {}
        }
      }
    }
  }
}

This newly defined policy will be created and assigned to have a version equal to 1. Since we haven’t assigned any indices to this policy, any updates that occur will be reflected completely on indices that are newly set to be managed by this policy.

Updating the Delete phase’s minimum age can be done in an update request.

PUT _ilm/policy/my_policy
{
  "policy": {
    "phases": {
      "hot": {
        "actions": {
          "rollover": {
            "max_size": "25GB"
          }
        }
      },
      "delete": {
        "min_age": "10d", 
        "actions": {
          "delete": {}
        }
      }
    }
  }
}

update min_age to 10 days

When we get the policy, we will see it reflect our latest changes, but with its version bumped to 2.

{
  "my_policy": {
    "version": 2, 
    "modified_date": 82392349, 
    "policy": {
      "phases": {
        "hot": {
          "min_age": "0ms",
          "actions": {
            "rollover": {
              "max_size": "25gb"
            }
          }
        },
        "delete": {
          "min_age": "10d",
          "actions": {
            "delete": {}
          }
        }
      }
    }
  }
}

The updated version value

The timestamp when this policy was updated last.

Afterwords, any indices set to my_policy will execute against version 2 of the policy.