Skip to content

Restoring ILM managed indices uses original indices' age for deletion #35561

@dakrone

Description

@dakrone

Consider the following (simplified) use case, you want to retain indices for a
period of time, and during that time, you take periodic snapshots of the
indices:

(30 seconds is a stand in for a longer time, to make this more easily
reproducible, pretend it is 90d or something for a production use case)

PUT _ilm/policy/delete-old
{
  "policy": {
    "phases": {
      "delete": {
        "min_age": "30s",
        "actions": {
          "delete": {}
        }
      }
    }
  }
}

And create an index using that policy

PUT /foo
{
  "settings": {
    "index.number_of_shards": 2,
    "index.lifecycle.name": "delete-old"
  }
}

After the index is created, during the periodic snapshotting, a snapshot is
taken:

PUT /_snapshot/backup
{
  "type": "fs",
  "settings": {
    "location": "/tmp/foo"
  }
}

PUT /_snapshot/backup/snap1?wait_for_completion=true

Next, after 30 seconds has elapsed, the index foo is deleted.

Later, a user decides they need the data on the "foo" index and thus need to
restore the index:

POST /_snapshot/backup/snap1/_restore

The index is restored... and then immediately deleted because it is older than
30 seconds.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions