[[reference-cluster-allocation_explain]]

////////
===========================================================================================================================
||                                                                                                                       ||
||                                                                                                                       ||
||                                                                                                                       ||
||        ██████╗ ███████╗ █████╗ ██████╗ ███╗   ███╗███████╗                                                            ||
||        ██╔══██╗██╔════╝██╔══██╗██╔══██╗████╗ ████║██╔════╝                                                            ||
||        ██████╔╝█████╗  ███████║██║  ██║██╔████╔██║█████╗                                                              ||
||        ██╔══██╗██╔══╝  ██╔══██║██║  ██║██║╚██╔╝██║██╔══╝                                                              ||
||        ██║  ██║███████╗██║  ██║██████╔╝██║ ╚═╝ ██║███████╗                                                            ||
||        ╚═╝  ╚═╝╚══════╝╚═╝  ╚═╝╚═════╝ ╚═╝     ╚═╝╚══════╝                                                            ||
||                                                                                                                       ||
||                                                                                                                       ||
||    This file is autogenerated, DO NOT send pull requests that changes this file directly.                             ||
||    You should update the script that does the generation, which can be found in:                                      ||
||    https://github.com/elastic/elastic-client-generator-js                                                             ||
||                                                                                                                       ||
||    You can run the script with the following command:                                                                 ||
||       npm run elasticsearch -- --version <version>                                                                    ||
||                                                                                                                       ||
||                                                                                                                       ||
||                                                                                                                       ||
===========================================================================================================================
////////

[discrete]
=== client.cluster.allocationExplain

Provides explanations for shard allocations in the cluster.

{ref}/cluster-allocation-explain.html[{es} documentation]

[discrete]
==== Function signature

[source,ts]
----
(ClusterAllocationExplainRequest, options?): Promise<ClusterAllocationExplainResponse>
----

[discrete]
==== ClusterAllocationExplainRequest

[pass]
++++
<pre>
++++
interface ClusterAllocationExplainRequest extends <<RequestBase>> {
  include_disk_info?: boolean
  include_yes_decisions?: boolean
  current_node?: string
  index?: <<IndexName>>
  primary?: boolean
  shard?: number
}

[pass]
++++
</pre>
++++
[discrete]
==== ClusterAllocationExplainResponse

[pass]
++++
<pre>
++++
interface ClusterAllocationExplainResponse {
  allocate_explanation?: string
  allocation_delay?: <<Duration>>
  allocation_delay_in_millis?: <<DurationValue>><<<UnitMillis>>>
  can_allocate?: ClusterAllocationExplainDecision
  can_move_to_other_node?: ClusterAllocationExplainDecision
  can_rebalance_cluster?: ClusterAllocationExplainDecision
  can_rebalance_cluster_decisions?: ClusterAllocationExplainAllocationDecision[]
  can_rebalance_to_other_node?: ClusterAllocationExplainDecision
  can_remain_decisions?: ClusterAllocationExplainAllocationDecision[]
  can_remain_on_current_node?: ClusterAllocationExplainDecision
  cluster_info?: ClusterAllocationExplainClusterInfo
  configured_delay?: <<Duration>>
  configured_delay_in_millis?: <<DurationValue>><<<UnitMillis>>>
  current_node?: ClusterAllocationExplainCurrentNode
  current_state: string
  index: <<IndexName>>
  move_explanation?: string
  node_allocation_decisions?: ClusterAllocationExplainNodeAllocationExplanation[]
  primary: boolean
  rebalance_explanation?: string
  remaining_delay?: <<Duration>>
  remaining_delay_in_millis?: <<DurationValue>><<<UnitMillis>>>
  shard: number
  unassigned_info?: ClusterAllocationExplainUnassignedInformation
  note?: string
}

[pass]
++++
</pre>
++++
