Method: Elasticsearch::API::Cluster::Actions#info

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

#info(arguments = {}) ⇒ Object

Returns different information about the cluster.

Parameters:

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

    a customizable set of options

Options Hash (arguments):

  • :target (List)

    Limit the information returned to the specified target. (options: _all, http, ingest, thread_pool, script)

  • :headers (Hash)

    Custom HTTP headers

Raises:

  • (ArgumentError)

See Also:

[View source]

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

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

  defined_params = [:target].each_with_object({}) do |variable, set_variables|
    set_variables[variable] = arguments[variable] if arguments.key?(variable)
  end
  request_opts[:defined_params] = defined_params unless defined_params.empty?

  raise ArgumentError, "Required argument 'target' missing" unless arguments[:target]

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

  body = nil

  _target = arguments.delete(:target)

  method = Elasticsearch::API::HTTP_GET
  path   = "_info/#{Utils.__listify(_target)}"
  params = {}

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