Method: Elasticsearch::API::Cluster::Actions#allocation_explain

Defined in:
lib/elasticsearch/api/actions/cluster/allocation_explain.rb

#allocation_explain(arguments = {}) ⇒ Object

Provides explanations for shard allocations in the cluster.

Parameters:

  • arguments (Hash) (defaults to: {})

    a customizable set of options

Options Hash (arguments):

  • :master_timeout (Time)

    Timeout for connection to master node

  • :include_yes_decisions (Boolean)

    Return ‘YES’ decisions in explanation (default: false)

  • :include_disk_info (Boolean)

    Return information about disk usage and shard sizes (default: false)

  • :headers (Hash)

    Custom HTTP headers

  • :body (Hash)

    The index, shard, and primary flag to explain. Empty means ‘explain a randomly-chosen unassigned shard’

See Also:


35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
# File 'lib/elasticsearch/api/actions/cluster/allocation_explain.rb', line 35

def allocation_explain(arguments = {})
  request_opts = { endpoint: arguments[:endpoint] || 'cluster.allocation_explain' }

  arguments = arguments.clone
  headers = arguments.delete(:headers) || {}

  body   = arguments.delete(:body)

  method = if body
             Elasticsearch::API::HTTP_POST
           else
             Elasticsearch::API::HTTP_GET
           end

  path = '_cluster/allocation/explain'
  params = Utils.process_params(arguments)

  Elasticsearch::API::Response.new(
    perform_request(method, path, params, body, headers, request_opts)
  )
end