Cluster allocation explain API

Provides explanations for shard allocations in the cluster.

Request

GET /_cluster/allocation/explain

Description

The purpose of the cluster allocation explain API is to provide explanations for shard allocations in the cluster. For unassigned shards, the explain API provides an explanation for why the shard is unassigned. For assigned shards, the explain API provides an explanation for why the shard is remaining on its current node and has not moved or rebalanced to another node. This API can be very useful when attempting to diagnose why a shard is unassigned or why a shard continues to remain on its current node when you might expect otherwise.

Query parameters

include_disk_info

(Optional, boolean) If true, returns information about disk usage and shard sizes. Defaults to false.

include_yes_decisions

(Optional, boolean) If true, returns YES decisions in explanation. Defaults to false.

Request body

current_node

(Optional, string) Specifies the node ID or the name of the node to only explain a shard that is currently located on the specified node.

index

(Optional, string) Specifies the name of the index that you would like an explanation for.

primary

(Optional, boolean) If true, returns explanation for the primary shard for the given shard ID.

shard

(Optional, integer) Specifies the ID of the shard that you would like an explanation for.

You can also have Elasticsearch explain the allocation of the first unassigned shard that it finds by sending an empty body for the request.

Examples

  1. GET /_cluster/allocation/explain
  2. {
  3. "index": "my-index-000001",
  4. "shard": 0,
  5. "primary": true
  6. }

Example of the current_node parameter

  1. GET /_cluster/allocation/explain
  2. {
  3. "index": "my-index-000001",
  4. "shard": 0,
  5. "primary": false,
  6. "current_node": "nodeA"
  7. }

The node where shard 0 currently has a replica on

Examples of unassigned primary shard explanations

  1. PUT /my-index-000001?master_timeout=1s&timeout=1s
  2. {"settings": {"index.routing.allocation.include._name": "non_existent_node"} }
  3. GET /_cluster/allocation/explain
  4. {
  5. "index": "my-index-000001",
  6. "shard": 0,
  7. "primary": true
  8. }

The API returns the following response for an unassigned primary shard:

  1. {
  2. "index" : "my-index-000001",
  3. "shard" : 0,
  4. "primary" : true,
  5. "current_state" : "unassigned",
  6. "unassigned_info" : {
  7. "reason" : "INDEX_CREATED",
  8. "at" : "2017-01-04T18:08:16.600Z",
  9. "last_allocation_status" : "no"
  10. },
  11. "can_allocate" : "no",
  12. "allocate_explanation" : "cannot allocate because allocation is not permitted to any of the nodes",
  13. "node_allocation_decisions" : [
  14. {
  15. "node_id" : "8qt2rY-pT6KNZB3-hGfLnw",
  16. "node_name" : "node-0",
  17. "transport_address" : "127.0.0.1:9401",
  18. "node_attributes" : {},
  19. "node_decision" : "no",
  20. "weight_ranking" : 1,
  21. "deciders" : [
  22. {
  23. "decider" : "filter",
  24. "decision" : "NO",
  25. "explanation" : "node does not match index setting [index.routing.allocation.include] filters [_name:\"non_existent_node\"]"
  26. }
  27. ]
  28. }
  29. ]
  30. }

The current state of the shard.

The reason for the shard originally becoming unassigned.

Whether to allocate the shard.

Whether to allocate the shard to the particular node.

The decider which led to the no decision for the node.

An explanation as to why the decider returned a no decision, with a helpful hint pointing to the setting that led to the decision.

The API response output for an unassigned primary shard that had previously been allocated to a node in the cluster:

  1. {
  2. "index" : "my-index-000001",
  3. "shard" : 0,
  4. "primary" : true,
  5. "current_state" : "unassigned",
  6. "unassigned_info" : {
  7. "reason" : "NODE_LEFT",
  8. "at" : "2017-01-04T18:03:28.464Z",
  9. "details" : "node_left[OIWe8UhhThCK0V5XfmdrmQ]",
  10. "last_allocation_status" : "no_valid_shard_copy"
  11. },
  12. "can_allocate" : "no_valid_shard_copy",
  13. "allocate_explanation" : "cannot allocate because a previous copy of the primary shard existed but can no longer be found on the nodes in the cluster"
  14. }

Example of an unassigned replica shard explanation

The API response output for a replica that is unassigned due to delayed allocation:

  1. {
  2. "index" : "my-index-000001",
  3. "shard" : 0,
  4. "primary" : false,
  5. "current_state" : "unassigned",
  6. "unassigned_info" : {
  7. "reason" : "NODE_LEFT",
  8. "at" : "2017-01-04T18:53:59.498Z",
  9. "details" : "node_left[G92ZwuuaRY-9n8_tc-IzEg]",
  10. "last_allocation_status" : "no_attempt"
  11. },
  12. "can_allocate" : "allocation_delayed",
  13. "allocate_explanation" : "cannot allocate because the cluster is still waiting 59.8s for the departed node holding a replica to rejoin, despite being allowed to allocate the shard to at least one other node",
  14. "configured_delay" : "1m",
  15. "configured_delay_in_millis" : 60000,
  16. "remaining_delay" : "59.8s",
  17. "remaining_delay_in_millis" : 59824,
  18. "node_allocation_decisions" : [
  19. {
  20. "node_id" : "pmnHu_ooQWCPEFobZGbpWw",
  21. "node_name" : "node_t2",
  22. "transport_address" : "127.0.0.1:9402",
  23. "node_decision" : "yes"
  24. },
  25. {
  26. "node_id" : "3sULLVJrRneSg0EfBB-2Ew",
  27. "node_name" : "node_t0",
  28. "transport_address" : "127.0.0.1:9400",
  29. "node_decision" : "no",
  30. "store" : {
  31. "matching_size" : "4.2kb",
  32. "matching_size_in_bytes" : 4325
  33. },
  34. "deciders" : [
  35. {
  36. "decider" : "same_shard",
  37. "decision" : "NO",
  38. "explanation" : "a copy of this shard is already allocated to this node [[my-index-000001][0], node[3sULLVJrRneSg0EfBB-2Ew], [P], s[STARTED], a[id=eV9P8BN1QPqRc3B4PLx6cg]]"
  39. }
  40. ]
  41. }
  42. ]
  43. }

The configured delay before allocating a replica shard that does not exist due to the node holding it leaving the cluster.

The remaining delay before allocating the replica shard.

Information about the shard data found on a node.

Examples of allocated shard explanations

The API response output for an assigned shard that is not allowed to remain on its current node and is required to move:

  1. {
  2. "index" : "my-index-000001",
  3. "shard" : 0,
  4. "primary" : true,
  5. "current_state" : "started",
  6. "current_node" : {
  7. "id" : "8lWJeJ7tSoui0bxrwuNhTA",
  8. "name" : "node_t1",
  9. "transport_address" : "127.0.0.1:9401"
  10. },
  11. "can_remain_on_current_node" : "no",
  12. "can_remain_decisions" : [
  13. {
  14. "decider" : "filter",
  15. "decision" : "NO",
  16. "explanation" : "node does not match index setting [index.routing.allocation.include] filters [_name:\"non_existent_node\"]"
  17. }
  18. ],
  19. "can_move_to_other_node" : "no",
  20. "move_explanation" : "cannot move shard to another node, even though it is not allowed to remain on its current node",
  21. "node_allocation_decisions" : [
  22. {
  23. "node_id" : "_P8olZS8Twax9u6ioN-GGA",
  24. "node_name" : "node_t0",
  25. "transport_address" : "127.0.0.1:9400",
  26. "node_decision" : "no",
  27. "weight_ranking" : 1,
  28. "deciders" : [
  29. {
  30. "decider" : "filter",
  31. "decision" : "NO",
  32. "explanation" : "node does not match index setting [index.routing.allocation.include] filters [_name:\"non_existent_node\"]"
  33. }
  34. ]
  35. }
  36. ]
  37. }

Whether the shard is allowed to remain on its current node.

The deciders that factored into the decision of why the shard is not allowed to remain on its current node.

Whether the shard is allowed to be allocated to another node.

The API response output for an assigned shard that remains on its current node because moving the shard to another node does not form a better cluster balance:

  1. {
  2. "index" : "my-index-000001",
  3. "shard" : 0,
  4. "primary" : true,
  5. "current_state" : "started",
  6. "current_node" : {
  7. "id" : "wLzJm4N4RymDkBYxwWoJsg",
  8. "name" : "node_t0",
  9. "transport_address" : "127.0.0.1:9400",
  10. "weight_ranking" : 1
  11. },
  12. "can_remain_on_current_node" : "yes",
  13. "can_rebalance_cluster" : "yes",
  14. "can_rebalance_to_other_node" : "no",
  15. "rebalance_explanation" : "cannot rebalance as no target node exists that can both allocate this shard and improve the cluster balance",
  16. "node_allocation_decisions" : [
  17. {
  18. "node_id" : "oE3EGFc8QN-Tdi5FFEprIA",
  19. "node_name" : "node_t1",
  20. "transport_address" : "127.0.0.1:9401",
  21. "node_decision" : "worse_balance",
  22. "weight_ranking" : 1
  23. }
  24. ]
  25. }

Whether rebalancing is allowed on the cluster.

Whether the shard can be rebalanced to another node.

The reason the shard cannot be rebalanced to the node, in this case indicating that it offers no better balance than the current node.