This file contains 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=YOUR_ES_HOST | |
PORT=YOUR_ES_PORT | |
TO_NODE=DESTINATION_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\" : |
This file contains 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
# example python script | |
# pip install requests before using requests | |
import requests | |
import json | |
HOSTNAME="your.elasticsearch.host.com" # hostname | |
PORT=9200 # port number | |
NODE_NAME="node001" # node to reroute to |