Method: Elasticsearch::API::Cluster::Actions#state

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

#state(arguments = {}) ⇒ Object

Returns a comprehensive information about the state of the cluster.

Parameters:

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

    a customizable set of options

Options Hash (arguments):

  • :metric (List)

    Limit the information returned to the specified metrics (options: _all, blocks, metadata, nodes, routing_table, routing_nodes, master_node, version)

  • :index (List)

    A comma-separated list of index names; use ‘_all` or empty string to perform the operation on all indices

  • :local (Boolean)

    Return local information, do not retrieve the state from master node (default: false)

  • :master_timeout (Time)

    Specify timeout for connection to master

  • :flat_settings (Boolean)

    Return settings in flat format (default: false)

  • :wait_for_metadata_version (Number)

    Wait for the metadata version to be equal or greater than the specified metadata version

  • :wait_for_timeout (Time)

    The maximum time to wait for wait_for_metadata_version before timing out

  • :ignore_unavailable (Boolean)

    Whether specified concrete indices should be ignored when unavailable (missing or closed)

  • :allow_no_indices (Boolean)

    Whether to ignore if a wildcard indices expression resolves into no concrete indices. (This includes ‘_all` string or when no indices have been specified)

  • :expand_wildcards (String)

    Whether to expand wildcard expression to concrete indices that are open, closed or both. (options: open, closed, hidden, none, all)

  • :headers (Hash)

    Custom HTTP headers

See Also:


41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
# File 'lib/elasticsearch/api/actions/cluster/state.rb', line 41

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

  body = nil

  _metric = arguments.delete(:metric)

  _index = arguments.delete(:index)

  method = Elasticsearch::API::HTTP_GET
  path   = if _metric && _index
             "_cluster/state/#{Utils.__listify(_metric)}/#{Utils.__listify(_index)}"
           elsif _metric
             "_cluster/state/#{Utils.__listify(_metric)}"
           else
             "_cluster/state"
           end
  params = Utils.process_params(arguments)

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