Created
August 11, 2016 14:10
-
-
Save fdv/a6018f77394d52ec5bbb596a9083b063 to your computer and use it in GitHub Desktop.
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/sh | |
HOST=$1 | |
CURL_BIN=$(which curl) | |
if [ -z "$HOST" ]; then | |
echo "Host is missing" | |
exit 1 | |
fi | |
if [ -z "$CURL_BIN" ]; then | |
echo "Curl binary is missing" | |
exit 1 | |
fi | |
for indice in $(${CURL_BIN} -XGET http://${HOST}:9200/_cat/indices | sort -rk 7 | awk '{print $3}'); do | |
if [ ! -z "$indice" ]; then | |
echo "Processing indice ${indice}" | |
${CURL_BIN} -XPOST http://${HOST}:9200/${indice}/_optimize?max_num_segments=1 | |
echo | |
fi | |
done | |
exit 0 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment