Module: Elasticsearch::API::Nodes::Actions

Included in:
NodesClient
Defined in:
lib/elasticsearch/api/namespace/nodes.rb,
lib/elasticsearch/api/actions/nodes/info.rb,
lib/elasticsearch/api/actions/nodes/stats.rb,
lib/elasticsearch/api/actions/nodes/usage.rb,
lib/elasticsearch/api/actions/nodes/shutdown.rb,
lib/elasticsearch/api/actions/nodes/hot_threads.rb,
lib/elasticsearch/api/actions/nodes/params_registry.rb,
lib/elasticsearch/api/actions/nodes/reload_secure_settings.rb

Defined Under Namespace

Modules: ParamsRegistry

Instance Method Summary collapse

Instance Method Details

#hot_threads(arguments = {}) ⇒ Object

*Deprecation notice*: The hot accepts /_cluster/nodes as prefix for backwards compatibility reasons Deprecated since version 7.0.0



29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
# File 'lib/elasticsearch/api/actions/nodes/hot_threads.rb', line 29

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

  _node_id = arguments.delete(:node_id)

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

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

#info(arguments = {}) ⇒ Object



21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
# File 'lib/elasticsearch/api/actions/nodes/info.rb', line 21

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

  _node_id = arguments.delete(:node_id)

  _metric = arguments.delete(:metric)

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

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

#reload_secure_settings(arguments = {}) ⇒ Object



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

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

  _node_id = arguments.delete(:node_id)

  method = Elasticsearch::API::HTTP_POST
  path   = if _node_id
             "_nodes/#{Utils.__listify(_node_id)}/reload_secure_settings"
           else
             "_nodes/reload_secure_settings"
end
  params = Utils.__validate_and_extract_params arguments, ParamsRegistry.get(__method__)

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

#shutdown(arguments = {}) ⇒ Object

Shutdown one or all nodes

Examples:

Shut down node named Bloke


client.nodes.shutdown node_id: 'Bloke'

Parameters:

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

    a customizable set of options

Options Hash (arguments):

  • :node_id (List)

    A comma-separated list of node IDs or names to perform the operation on; use ‘_local` to shutdown the node you’re connected to, leave empty to shutdown all nodes

  • :delay (Time)

    Set the delay for the operation (default: 1s)

  • :exit (Boolean)

    Exit the JVM as well (default: true)

See Also:



23
24
25
26
27
28
29
30
31
# File 'lib/elasticsearch/api/actions/nodes/shutdown.rb', line 23

def shutdown(arguments = {})
  method = HTTP_POST
  path   = Utils.__pathify '_cluster/nodes', Utils.__listify(arguments[:node_id]), '_shutdown'

  params = Utils.__validate_and_extract_params arguments, ParamsRegistry.get(__method__)
  body   = nil

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

#stats(arguments = {}) ⇒ Object



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
57
58
59
# File 'lib/elasticsearch/api/actions/nodes/stats.rb', line 32

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

  _node_id = arguments.delete(:node_id)

  _metric = arguments.delete(:metric)

  _index_metric = arguments.delete(:index_metric)

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

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

#usage(arguments = {}) ⇒ Object



20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
# File 'lib/elasticsearch/api/actions/nodes/usage.rb', line 20

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

  _node_id = arguments.delete(:node_id)

  _metric = arguments.delete(:metric)

  method = Elasticsearch::API::HTTP_GET
  path   = if _node_id && _metric
             "_nodes/#{Utils.__listify(_node_id)}/usage/#{Utils.__listify(_metric)}"
           elsif _node_id
             "_nodes/#{Utils.__listify(_node_id)}/usage"
           elsif _metric
             "_nodes/usage/#{Utils.__listify(_metric)}"
           else
             "_nodes/usage"
end
  params = Utils.__validate_and_extract_params arguments, ParamsRegistry.get(__method__)

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