Created
January 4, 2018 17:21
-
-
Save miceno/a7faf5698101ee764eb4264b7b20ead0 to your computer and use it in GitHub Desktop.
Bulk remove elasticsearch indexes
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env bash | |
SERVER="http://elasticsearch.server.example.com:9200" | |
curl "$SERVER/_cat/indices?v" | awk '{ print $3}' | sort > /tmp/indexes.txt | |
while read -u 3 f; | |
do | |
echo $f | |
COMMAND="curl -XDELETE $SERVER/$f" | |
echo $COMMAND | |
$COMMAND | |
read -e -p "Continue.... " -n 1 | |
done 3< /tmp/indexes.txt |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment