Delete

edit

Phases allowed: delete.

Permanently removes the index.

Options

edit
delete_searchable_snapshot

(Optional, Boolean) Deletes the searchable snapshot created in a previous phase. Defaults to true. This option is applicable when the searchable snapshot action is used in any previous phase.

If you set this option to false, use the Delete snapshots API to remove searchable snapshots from your snapshot repository when they are no longer needed.

If you manually delete an index before the Index lifecycle management delete phase runs, then ILM will not delete the underlying searchable snapshot. Use the Delete snapshots API to remove the searchable snapshot from your snapshot repository when it is no longer needed.

See Reliability of searchable snapshots for further information about deleting searchable snapshots.

If a policy with a searchable snapshot action is applied on an existing searchable snapshot index, the snapshot backing this index will NOT be deleted because it was not created by this policy. If you want to clean this snapshot, please delete it manually after the index is deleted using the delete snapshot API, you can find the repository and snapshot name using the get index API.

Example

edit
resp = client.ilm.put_lifecycle(
    name="my_policy",
    policy={
        "phases": {
            "delete": {
                "actions": {
                    "delete": {}
                }
            }
        }
    },
)
print(resp)
response = client.ilm.put_lifecycle(
  policy: 'my_policy',
  body: {
    policy: {
      phases: {
        delete: {
          actions: {
            delete: {}
          }
        }
      }
    }
  }
)
puts response
const response = await client.ilm.putLifecycle({
  name: "my_policy",
  policy: {
    phases: {
      delete: {
        actions: {
          delete: {},
        },
      },
    },
  },
});
console.log(response);
PUT _ilm/policy/my_policy
{
  "policy": {
    "phases": {
      "delete": {
        "actions": {
          "delete" : { }
        }
      }
    }
  }
}