Skip to content

elasticsearch get-cluster-allocation

Get an explanation for shards current allocation

Description

Get an explanation for shards current allocation.

Synopsis

elasticsearch get-cluster-allocation
    [--site <site>]
    [--cluster <cluster>]
    [--filter_path <filter_path>]
    --index <index>
    <shard>
    [--primary]
    --current_node <current_node>

Arguments

site - (string)

     Site where this command will be executed
     Example: --site "site-1"
     Default: input.site      Attributes: optional

cluster - (string)

     Name of elastic search cluster
     Example: --cluster "elastic-default"
     Default: elastic-default      Attributes: optional

filter_path - (string)

     Path in the response. Filters and returns only parts of response matching this path
     Example: --filter_path "index.mappings.properties.*"
     Default: _None_      Attributes: optional, multiple allowed

index - (string)

     Name of the index that you would like an explanation for.
     Example: --index "students"
     Default: _None_      Attributes: required

shard - (int)

     ID of the shard that you would like an explanation for.
     Example: 1
     Default: _None_      Attributes: required

primary - (bool)

     If set, returns explanation for the primary shard for the given shard ID.
     Example: --primary
     Default: _None_      Attributes: optional

current_node - (string)

     Specifies the node ID or the name of the node to only explain a shard that is currently located on the specified node.
     Example: --current_node "node-1"
     Default: _None_      Attributes: required

Examples

Input:

! elasticsearch get-cluster-allocation --cluster "elastic-1" --primary --index "class" 1 --current_node "beehyv-H81M-S"
Output:
{
  "index": "class",
  "shard": 1,
  "primary": true,
  "current_state": "started",
  "current_node": {
    "id": "qQmwEJbkTdW-ixce6PgTFQ",
    "name": "beehyv-H81M-S",
    "transport_address": "127.0.0.1:9300",
    "attributes": {
      "ml.machine_memory": "16714620928",
      "xpack.installed": "true",
      "transform.node": "true",
      "ml.max_open_jobs": "512",
      "ml.max_jvm_size": "1073741824"
    },
    "weight_ranking": 1
  },
  "can_remain_on_current_node": "yes",
  "can_rebalance_cluster": "no",
  "can_rebalance_cluster_decisions": [
    {
      "decider": "rebalance_only_when_active",
      "decision": "NO",
      "explanation": "rebalancing is not allowed until all replicas in the cluster are active"
    },
    {
      "decider": "cluster_rebalance",
      "decision": "NO",
      "explanation": "the cluster has unassigned shards and cluster setting [cluster.routing.allocation.allow_rebalance] is set to [indices_all_active]"
    }
  ],
  "can_rebalance_to_other_node": "no",
  "rebalance_explanation": "rebalancing is not allowed"
}

Access Control

To use this command, you need access to the following:

Field Value
Action "read"
Service Type "elasticsearch"
Service Instance cluster
Namespace
Object Type "index"
Object ID index

Please see Access Control for details.