Skip to content

Instantly share code, notes, and snippets.

@hkrishna
Last active August 29, 2015 14:18
Show Gist options
  • Save hkrishna/288e643589c8856c7309 to your computer and use it in GitHub Desktop.
Save hkrishna/288e643589c8856c7309 to your computer and use it in GitHub Desktop.
Dealing with unassigned shards
for shard in $(curl -XGET http://localhost:9200/_cat/shards | grep UNASSIGNED | awk '{print $2}'); do
curl -XPOST 'localhost:9200/_cluster/reroute' -d '{
"commands" : [ {
"allocate" : {
"index" : "pelias",
"shard" : $shard,
"node" : "pelias-1",
"allow_primary" : true
}
}
]
}'
sleep 5
done
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment