younifyd
Menu

Reroute the cluster

Reroute the cluster

POST/_cluster/reroute

Use it in a workflow

  1. Add a step and choose the Elasticsearch connector.
  2. Pick the Reroute the cluster action (under cluster).
  3. Fill in the fields below, then reference the result from later steps as {{rerouteTheCluster.response.data}}.

Request

Query parameters

dry_runboolean

If true, then the request simulates the operation. It will calculate the result of applying the commands to the current cluster state and return the resulting cluster state after the commands (and rebalancing) have been applied; it will not actually perform the requested changes.

explainboolean

If true, then the response contains an explanation of why the commands can or cannot run.

metriconeOf

Limits the information returned to the specified metrics.

retry_failedboolean

If true, then retries allocation of shards that are blocked due to too many subsequent allocation failures.

master_timeoutoneOf

Period to wait for a connection to the master node. If no response is received before the timeout expires, the request fails and returns an error.

timeoutoneOf

Period to wait for a response. If no response is received before the timeout expires, the request fails and returns an error.

Request body

Enter the body as JSON in the step's Body field.

commandsarray<object>

Defines the commands to perform.

cancelany

Cancel allocation of a shard (or recovery). Accepts index and shard for index name and shard number, and node for the node to cancel the shard allocation on. This can be used to force resynchronization of existing replicas from the primary shard by cancelling them and allowing them to be reinitialized through the standard recovery process. By default only replica shard allocations can be cancelled. If it is necessary to cancel the allocation of a primary shard then the allow_primary flag must also be included in the request.

moveany

Move a started shard from one node to another node. Accepts index and shard for index name and shard number, from_node for the node to move the shard from, and to_node for the node to move the shard to.

allocate_replicaany

Allocate an unassigned replica shard to a node. Accepts index and shard for index name and shard number, and node to allocate the shard to. Takes allocation deciders into account.

allocate_stale_primaryany

Allocate a primary shard to a node that holds a stale copy. Accepts the index and shard for index name and shard number, and node to allocate the shard to. Using this command may lead to data loss for the provided shard id. If a node which has the good copy of the data rejoins the cluster later on, that data will be deleted or overwritten with the data of the stale copy that was forcefully allocated with this command. To ensure that these implications are well-understood, this command requires the flag accept_data_loss to be explicitly set to true.

allocate_empty_primaryany

Allocate an empty primary shard to a node. Accepts the index and shard for index name and shard number, and node to allocate the shard to. Using this command leads to a complete loss of all data that was indexed into this shard, if it was previously started. If a node which has a copy of the data rejoins the cluster later on, that data will be deleted. To ensure that these implications are well-understood, this command requires the flag accept_data_loss to be explicitly set to true.

json
{
  "commands": [
    {
      "cancel": null,
      "move": null,
      "allocate_replica": null,
      "allocate_stale_primary": null,
      "allocate_empty_primary": null
    }
  ]
}

Response

Returns 200 with an object. Read it in later steps with {{rerouteTheCluster.response.data.<field>}}.

acknowledgedboolean
explanationsarray<object>
commandstringrequired
decisionsarray<object>required3 fields
parametersanyrequired
stateobject

There aren't any guarantees on the output/structure of the raw cluster state. Here you will find the internal representation of the cluster, which can differ from the external representation.

json
{
  "acknowledged": false,
  "explanations": [
    {
      "command": "string",
      "decisions": [
        {
          "decider": "string",
          "decision": "string",
          "explanation": "string"
        }
      ],
      "parameters": null
    }
  ],
  "state": {}
}

Need more? See the Elasticsearch guide for connection setup and behaviour shared by every action.