Skip to content

Instantly share code, notes, and snippets.

@miceno
Created January 4, 2018 17:21
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 miceno/a7faf5698101ee764eb4264b7b20ead0 to your computer and use it in GitHub Desktop.
Save miceno/a7faf5698101ee764eb4264b7b20ead0 to your computer and use it in GitHub Desktop.
Bulk remove elasticsearch indexes
#!/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