Skip to content

Instantly share code, notes, and snippets.

@larsar
Created September 7, 2017 13:03
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save larsar/de672740f06a55ff7dd8bb42b2be9f29 to your computer and use it in GitHub Desktop.
Save larsar/de672740f06a55ff7dd8bb42b2be9f29 to your computer and use it in GitHub Desktop.
Delete Elasticsearch snapshots for a date range
#!/usr/bin/env bash
d=2016-02-14
while [ "$d" != 2016-03-01 ]; do
curl -X DELETE http://<HOST>/_snapshot/<INDEX>/snapshot-`echo $d | tr - .` -H 'content-type: application/json'
d=$(date -I -d "$d + 1 day")
done
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment