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

Returns information about hot threads on each node in the cluster.

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

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 limit the returned information; use `_local` to return information from the node you're connecting to, leave empty to get information from all nodes

  • :interval (Time)

    The interval for the second sampling of threads

  • :snapshots (Number)

    Number of samples of thread stacktrace (default: 10)

  • :threads (Number)

    Specify the number of threads to provide information for (default: 3)

  • :ignore_idle_threads (Boolean)

    Don't show threads that are in known-idle places, such as waiting on a socket select or pulling from an empty task queue (default: true)

  • :type (String)

    The type to sample (default: cpu) (options: cpu, wait, block)

  • :timeout (Time)

    Explicit operation timeout

  • :headers (Hash)

    Custom HTTP headers

See Also:


40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
# File 'lib/elasticsearch/api/actions/nodes/hot_threads.rb', line 40

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

  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, headers).body
end

#info(arguments = {}) ⇒ Object

Returns information about nodes in the cluster.

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 limit the returned information; use `_local` to return information from the node you're connecting to, leave empty to get information from all nodes

  • :metric (List)

    A comma-separated list of metrics you wish returned. Leave empty to return all. (options: settings, os, process, jvm, thread_pool, transport, http, plugins, ingest)

  • :flat_settings (Boolean)

    Return settings in flat format (default: false)

  • :timeout (Time)

    Explicit operation timeout

  • :headers (Hash)

    Custom HTTP headers

See Also:


32
33
34
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/nodes/info.rb', line 32

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

  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, headers).body
end

#reload_secure_settings(arguments = {}) ⇒ Object

Reloads secure settings.

Parameters:

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

    a customizable set of options

Options Hash (arguments):

  • :node_id (List)

    A comma-separated list of node IDs to span the reload/reinit call. Should stay empty because reloading usually involves all cluster nodes.

  • :timeout (Time)

    Explicit operation timeout

  • :headers (Hash)

    Custom HTTP headers

  • :body (Hash)

    An object containing the password for the elasticsearch keystore

See Also:


31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
# File 'lib/elasticsearch/api/actions/nodes/reload_secure_settings.rb', line 31

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

  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 = arguments[:body]
  perform_request(method, path, params, body, headers).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:


36
37
38
39
40
41
42
43
44
# File 'lib/elasticsearch/api/actions/nodes/shutdown.rb', line 36

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

Returns statistical information about nodes in the cluster.

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 limit the returned information; use `_local` to return information from the node you're connecting to, leave empty to get information from all nodes

  • :metric (List)

    Limit the information returned to the specified metrics (options: _all, breaker, fs, http, indices, jvm, os, process, thread_pool, transport, discovery, indexing_pressure)

  • :index_metric (List)

    Limit the information returned for `indices` metric to the specific index metrics. Isn't used if `indices` (or `all`) metric isn't specified. (options: _all, completion, docs, fielddata, query_cache, flush, get, indexing, merge, request_cache, refresh, search, segments, store, warmer, suggest)

  • :completion_fields (List)

    A comma-separated list of fields for `fielddata` and `suggest` index metric (supports wildcards)

  • :fielddata_fields (List)

    A comma-separated list of fields for `fielddata` index metric (supports wildcards)

  • :fields (List)

    A comma-separated list of fields for `fielddata` and `completion` index metric (supports wildcards)

  • :groups (Boolean)

    A comma-separated list of search groups for `search` index metric

  • :level (String)

    Return indices stats aggregated at index, node or shard level (options: indices, node, shards)

  • :types (List)

    A comma-separated list of document types for the `indexing` index metric

  • :timeout (Time)

    Explicit operation timeout

  • :include_segment_file_sizes (Boolean)

    Whether to report the aggregated disk usage of each one of the Lucene index files (only applies if segment stats are requested)

  • :include_unloaded_segments (Boolean)

    If set to true segment stats will include stats for segments that are not currently loaded into memory

  • :headers (Hash)

    Custom HTTP headers

See Also:


40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
# File 'lib/elasticsearch/api/actions/nodes/stats.rb', line 40

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

  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, headers).body
end

#usage(arguments = {}) ⇒ Object

Returns low-level information about REST actions usage on nodes.

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 limit the returned information; use `_local` to return information from the node you're connecting to, leave empty to get information from all nodes

  • :metric (List)

    Limit the information returned to the specified metrics (options: _all, rest_actions)

  • :timeout (Time)

    Explicit operation timeout

  • :headers (Hash)

    Custom HTTP headers

See Also:


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

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

  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, headers).body
end