Allows to manually change the allocation of individual shards in the cluster Added in 5.0.0
Query parameters
-
dry_run boolean
If true, then the request simulates the operation only and returns the resulting state.
-
explain boolean
If true, then the response contains an explanation of why the commands can or cannot be executed.
-
metric string | array[string]
Limits the information returned to the specified metrics.
-
retry_failed boolean
If true, then retries allocation of shards that are blocked due to too many subsequent allocation failures.
-
master_timeout string
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.
-
timeout string
Period to wait for a response. If no response is received before the timeout expires, the request fails and returns an error.
POST /_cluster/reroute
curl \
-X POST http://api.example.com/_cluster/reroute \
-H "Content-Type: application/json" \
-d '"{\n \"commands\": [\n {\n \"move\": {\n \"index\": \"test\", \"shard\": 0,\n \"from_node\": \"node1\", \"to_node\": \"node2\"\n }\n },\n {\n \"allocate_replica\": {\n \"index\": \"test\", \"shard\": 1,\n \"node\": \"node3\"\n }\n }\n ]\n}"'
Request example
{
"commands": [
{
"move": {
"index": "test", "shard": 0,
"from_node": "node1", "to_node": "node2"
}
},
{
"allocate_replica": {
"index": "test", "shard": 1,
"node": "node3"
}
}
]
}
Response examples (200)
{
"acknowledged": true,
"explanations": [
{
"command": "string",
"decisions": [
{
"decider": "string",
"decision": "string",
"explanation": "string"
}
],
"parameters": {
"allow_primary": true,
"index": "string",
"node": "string",
"shard": 42.0,
"from_node": "string",
"to_node": "string"
}
}
],
"state": {}
}