Created
August 23, 2016 21:42
-
-
Save kszarek/868c5d8d1dd61e876d7913e4e3e472bb to your computer and use it in GitHub Desktop.
Remove document type from ES index
This file contains hidden or 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
#!/bin/bash | |
set -e | |
type=application | |
month=2016.02 | |
for index in $(curl -s 'localhost:9200/_cat/shards'|grep $month|awk '{print $1}'|sort|uniq) | |
do | |
echo | |
echo "Cleaning $index" | |
echo | |
curl -XDELETE http://localhost:9200/${index}/${type} | |
curl -XPOST http://localhost:9200/${index}/_optimize?only_expunge_deletes=true | |
done |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment