Delete all Elasticsearch snapshots at once.
I have a couple of file system snapshot repositories like the following.
PUT /_snapshot/test
{
"type": "fs",
"settings": {
"location": "/mnt/nfs/test",
"max_restore_bytes_per_sec": "1024mb",
"compress": "true",
"max_snapshot_bytes_per_sec": "1024mb"
}
}
And I have snapshots from 2021 in that repositories. The snapshots look like the following.
- index_name-2021-02-03
- index_name-2021-02-04
- index_name-2021-02-05
- ...
- index_name-2023-05-25
The only method I can find is removing snapshots one by one with some shell script, each snapshot deletion process takes 20 minutes. the index_name
index size of about 10TB (1 pri + 1 rep).
the Elasticsearch version is 7.7.
Questions:
- Is there any way to remove multiple snapshots at once? (with regex)
- Will it be faster if I remove multiple snapshots at once like
DELETE _snapshot/repo_name/index_name-2021-02-03,index_name-2021-02-04
? - How can I remove all snapshots in the repository? (removing a repository won't remove snapshots.)
Similar question. How to delete a snapshot data in Elasticsearch?