Created
November 27, 2017 16:09
-
-
Save inthecloud247/a58c7784e171e2d4ae3bf44597c6a8c9 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
HOST=localhost | |
PORT=9200 | |
TO_NODE=YOUR_NODE_NAME | |
curl "http://$HOST:$PORT/_cat/shards" | grep UNAS | awk '{print $1,$2}' | while read var_index var_shard; do | |
curl -XPOST "http://$HOST:$PORT/_cluster/reroute" -d " | |
{ | |
\"commands\" : [ | |
{ | |
\"allocate\" : | |
{ | |
\"index\" : \"$var_index\", | |
\"shard\" : $var_shard, | |
\"node\" : \"$TO_NODE\", | |
\"allow_primary\" : true | |
} | |
} | |
] | |
}" ; | |
sleep 2; | |
done |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment