Skip to content

Instantly share code, notes, and snippets.

@inthecloud247
Created November 27, 2017 16:09
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 inthecloud247/a58c7784e171e2d4ae3bf44597c6a8c9 to your computer and use it in GitHub Desktop.
Save inthecloud247/a58c7784e171e2d4ae3bf44597c6a8c9 to your computer and use it in GitHub Desktop.
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