You could everything through the API.

- list all the snapshots in the repository
- parse the JSON returned
- for each snapshot, if it's older than 7 days, delete the snapshot

Le mardi 20 janvier 2015 19:19:38 UTC-2, abutalib zaidi a écrit :
>
> I am fairly new to ElasticSearch and was trying to do some backup and 
> restore using the API. I wrote a shell script to remove snapshots older 
> than certain days but it somehow removes the repo instead of the snapshots 
> info stored in a variable. Any help would be appreciated:
>
> #Remove snapshots older than 7 days
> cd /snapshot/directory
>
> OLD_BACKUP=`find snapshot-* -mtime +7 ` 
>
> OLD_SNAPSHOT=`for filename in ${OLD_BACKUP}; do
>   [ -f "$filename" ] || continue
>   mv $filename ${filename//snapshot-/}
> done `
>
> curl -XDELETE "xyz.com:9200/_snapshot/handoff_backup/${OLD_SNAPSHOT} 
> <http://argentina.pdi.com:9200/_snapshot/handoff_backup/$%7BOLD_SNAPSHOT%7D>
> "
>

-- 
You received this message because you are subscribed to the Google Groups 
"elasticsearch" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to elasticsearch+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/elasticsearch/da6a210c-3949-4e0d-aaa5-4e05ebf14248%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to