Module: Elasticsearch::API::Cluster::Actions

Included in:
ClusterClient
Defined in:
lib/elasticsearch/api/namespace/cluster.rb,
lib/elasticsearch/api/actions/cluster/state.rb,
lib/elasticsearch/api/actions/cluster/stats.rb,
lib/elasticsearch/api/actions/cluster/health.rb,
lib/elasticsearch/api/actions/cluster/reroute.rb,
lib/elasticsearch/api/actions/cluster/remote_info.rb,
lib/elasticsearch/api/actions/cluster/get_settings.rb,
lib/elasticsearch/api/actions/cluster/put_settings.rb,
lib/elasticsearch/api/actions/cluster/pending_tasks.rb,
lib/elasticsearch/api/actions/cluster/params_registry.rb,
lib/elasticsearch/api/actions/cluster/allocation_explain.rb

Defined Under Namespace

Modules: ParamsRegistry

Instance Method Summary collapse

Instance Method Details

#allocation_explain(arguments = {}) ⇒ Object

Parameters:

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

    a customizable set of options

Options Hash (arguments):

  • :body (Hash)

    The index, shard, and primary flag to explain. Empty means ‘explain the first unassigned shard’

See Also:



18
19
20
21
22
23
24
25
26
27
# File 'lib/elasticsearch/api/actions/cluster/allocation_explain.rb', line 18

def allocation_explain(arguments = {})
  arguments = arguments.clone

  method = Elasticsearch::API::HTTP_GET
  path   = "_cluster/allocation/explain"
  params = Utils.__validate_and_extract_params arguments, ParamsRegistry.get(__method__)

  body = arguments[:body]
  perform_request(method, path, params, body).body
end

#get_settings(arguments = {}) ⇒ Object



19
20
21
22
23
24
25
26
27
28
# File 'lib/elasticsearch/api/actions/cluster/get_settings.rb', line 19

def get_settings(arguments = {})
  arguments = arguments.clone

  method = Elasticsearch::API::HTTP_GET
  path   = "_cluster/settings"
  params = Utils.__validate_and_extract_params arguments, ParamsRegistry.get(__method__)

  body = nil
  perform_request(method, path, params, body).body
end

#health(arguments = {}) ⇒ Object



34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
# File 'lib/elasticsearch/api/actions/cluster/health.rb', line 34

def health(arguments = {})
  arguments = arguments.clone

  _index = arguments.delete(:index)

  method = Elasticsearch::API::HTTP_GET
  path   = if _index
             "_cluster/health/#{Utils.__listify(_index)}"
           else
             "_cluster/health"
end
  params = Utils.__validate_and_extract_params arguments, ParamsRegistry.get(__method__)

  body = nil
  perform_request(method, path, params, body).body
end

#pending_tasks(arguments = {}) ⇒ Object



18
19
20
21
22
23
24
25
26
27
# File 'lib/elasticsearch/api/actions/cluster/pending_tasks.rb', line 18

def pending_tasks(arguments = {})
  arguments = arguments.clone

  method = Elasticsearch::API::HTTP_GET
  path   = "_cluster/pending_tasks"
  params = Utils.__validate_and_extract_params arguments, ParamsRegistry.get(__method__)

  body = nil
  perform_request(method, path, params, body).body
end

#put_settings(arguments = {}) ⇒ Object

Parameters:

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

    a customizable set of options

Options Hash (arguments):

  • :body (Hash)

    The settings to be updated. Can be either ‘transient` or `persistent` (survives cluster restart). (Required)

Raises:

  • (ArgumentError)

See Also:



19
20
21
22
23
24
25
26
27
28
29
30
# File 'lib/elasticsearch/api/actions/cluster/put_settings.rb', line 19

def put_settings(arguments = {})
  raise ArgumentError, "Required argument 'body' missing" unless arguments[:body]

  arguments = arguments.clone

  method = Elasticsearch::API::HTTP_PUT
  path   = "_cluster/settings"
  params = Utils.__validate_and_extract_params arguments, ParamsRegistry.get(__method__)

  body = arguments[:body] || {}
  perform_request(method, path, params, body).body
end

#remote_info(arguments = {}) ⇒ Object



15
16
17
18
19
20
21
22
23
24
# File 'lib/elasticsearch/api/actions/cluster/remote_info.rb', line 15

def remote_info(arguments = {})
  arguments = arguments.clone

  method = Elasticsearch::API::HTTP_GET
  path   = "_remote/info"
  params = {}

  body = nil
  perform_request(method, path, params, body).body
end

#reroute(arguments = {}) ⇒ Object

Parameters:

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

    a customizable set of options

Options Hash (arguments):

  • :body (Hash)

    The definition of ‘commands` to perform (`move`, `cancel`, `allocate`)

See Also:



24
25
26
27
28
29
30
31
32
33
# File 'lib/elasticsearch/api/actions/cluster/reroute.rb', line 24

def reroute(arguments = {})
  arguments = arguments.clone

  method = Elasticsearch::API::HTTP_POST
  path   = "_cluster/reroute"
  params = Utils.__validate_and_extract_params arguments, ParamsRegistry.get(__method__)

  body = arguments[:body] || {}
  perform_request(method, path, params, body).body
end

#state(arguments = {}) ⇒ Object



28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
# File 'lib/elasticsearch/api/actions/cluster/state.rb', line 28

def state(arguments = {})
  arguments = arguments.clone

  _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.__validate_and_extract_params arguments, ParamsRegistry.get(__method__)

  body = nil
  perform_request(method, path, params, body).body
end

#stats(arguments = {}) ⇒ Object



18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
# File 'lib/elasticsearch/api/actions/cluster/stats.rb', line 18

def stats(arguments = {})
  arguments = arguments.clone

  _node_id = arguments.delete(:node_id)

  method = Elasticsearch::API::HTTP_GET
  path   = if _node_id
             "_cluster/stats/nodes/#{Utils.__listify(_node_id)}"
           else
             "_cluster/stats"
end
  params = Utils.__validate_and_extract_params arguments, ParamsRegistry.get(__method__)

  body = nil
  perform_request(method, path, params, body).body
end