Elasticsearch OpenSearch Rebalance

Opster Team

Oct 30, 2022 | 1 min read

In addition to reading this guide, we recommend you run the Elasticsearch Health Check-Up. It will detect issues and improve your Elasticsearch performance by analyzing your shard sizes, threadpools, memory, snapshots, disk watermarks and more.

The Elasticsearch Check-Up is free and requires no installation.

To manage all aspects of your OpenSearch operation, you can use Opster’s Management Console (OMC). The OMC makes it easy to orchestrate and manage OpenSearch in any environment. Using the OMC you can deploy multiple clusters, configure node roles, scale cluster resources, manage certificates and more – all from a single interface, for free. Check it out here.


Cluster rebalancing is the process by which an OpenSearch cluster distributes data across the nodes. Specifically, it refers to the movement of existing data shards to another node to improve the balance across the nodes (as opposed to the allocation of new shards to nodes). Usually, it is a completely automatic process that requires no outside intervention. However, there are a number of parameters OpenSearch uses to regulate this process.


The command below will establish the cluster settings to enable automatic cluster rebalancing. It is not necessary to run the command (the values used are in fact the defaults).

PUT /_cluster/settings?flat_settings=true
	"transient" : {
"cluster.routing.rebalance.enable": "all",
"cluster.routing.allocation.allow_rebalance":  "indices_all_active"	,


Notes and good things to know

In general, the cluster rebalance settings have sensible defaults. It is generally not advisable to disable cluster rebalancing. It is usually most sensible to wait until indices are all active before rebalancing since we consider the highest priority to be recovering the indices rather than moving them around. Finally, it is recommended to limit the number of concurrent rebalances to 2 (the default) since having a large number of shards moving around at a given time can use a lot of resources resource and cause instability. Increasing this number would only make sense on large clusters.

You can consider the “rebalance” process to be a tendency to spread the total number of shards across all nodes in the cluster, and also to spread the total number of shards for a given index as evenly as possible across the cluster. The rebalance is a “soft” algorithm, and will be overruled by other “hard” factors such as disk-based or shard allocation awareness.  

If you think your cluster is not rebalancing as it should first check the “hard” limits you have on shard allocation awareness or disk-based shard allocation before tweaking the rebalance parameters.

Manual rebalancing

It is also possible to rebalance manually using a command like this:

POST /_cluster/reroute?dry_run=true
    "commands" : [
            "move" : {
                "index" : "test", "shard" : 0,
                "from_node" : "node1", "to_node" : "node2"

It is advisable to include the dry_run parameter to check the result of your action, and if everything is in order then repeat the command with dry_run=false.

Bear in mind that if you rebalance manually, OpenSearch may move the same (or another shard) back automatically, compensating for your previous action. Similarly, there may be constraints that will prevent your reallocation from being accepted by the cluster.

Watch product tour

Watch how AutoOps finds & fixes Elasticsearch problems

Analyze Your Cluster
Skip to content