Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to move all elasticsearch shards from one node to another?

In ElasticSearch 2.X you can move shards around using reroute:

https://www.elastic.co/guide/en/elasticsearch/reference/current/cluster-reroute.html#cluster-reroute

Other than specifying a move for each shard, is there an easy way to move all off them from one node to another?

like image 303
AXE Labs Avatar asked Oct 27 '25 14:10

AXE Labs


1 Answers

Rerouting will not ensure the shards remain in the new node. Elasticsearch may try to balance things out and move some shards back to the original node. If you want to pin the shards to the new node, you need to use Shard Allocation Filtering.

If you want to move all shards of index index1 to node node1, then the command to execute is:

PUT index1/_settings
{
  "index.routing.allocation.include._name": "node1"
}
like image 77
bittusarkar Avatar answered Oct 29 '25 19:10

bittusarkar



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!