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/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 the hottest threads in the cluster or on a specific node as a String.

The information is returned as text, and allows you to understand what are currently the most taxing operations happening in the cluster, for debugging or monitoring purposes.

Examples:

Return 10 hottest threads


client.nodes.hot_threads threads: 10

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

See Also:



26
27
28
29
30
31
32
33
34
# File 'lib/elasticsearch/api/actions/nodes/hot_threads.rb', line 26

def hot_threads(arguments={})
  method = HTTP_GET
  path   = Utils.__pathify '_nodes', Utils.__listify(arguments[:node_id]), 'hot_threads'

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

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

#info(arguments = {}) ⇒ Object

Returns information about nodes in the cluster (cluster settings, JVM version, etc).

Use the ‘all` option to return all available settings, or limit the information returned to a specific type (eg. `http`).

Use the ‘node_id` option to limit information to specific node(s).

Examples:

Return information about JVM


client.nodes.info jvm: true

Return information about HTTP and network


client.nodes.info http: true, network: true

Pass a list of metrics


client.nodes.info metric: ['http', 'network']

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

See Also:



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

def info(arguments={})
  arguments = arguments.clone
  metric    = arguments.delete(:metric)
  method = HTTP_GET
  if metric
    parts = metric
  else
    parts = Utils.__extract_parts arguments, ParamsRegistry.get(:info_parts)
  end

  path   = Utils.__pathify '_nodes', Utils.__listify(arguments[:node_id]), Utils.__listify(parts)

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

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

#reload_secure_settings(arguments = {}) ⇒ Object

Re-read the local node’s encrypted keystore. Specifically, it will prompt the keystore decryption and reading across the cluster.

Examples:

Reload secure settings for all nodes


client.nodes.reload_secure_settings

Reload secure settings for a list of nodes


client.nodes.reload_secure_settings(node_id: 'foo,bar')

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

See Also:



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

def reload_secure_settings(arguments={})
  valid_params = [
      :timeout ]

  method = HTTP_POST
  path   = Utils.__pathify '_nodes', Utils.__listify(arguments[:node_id]), 'reload_secure_settings'

  params = Utils.__validate_and_extract_params arguments, valid_params
  body   = nil

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

#stats(arguments = {}) ⇒ Object

Returns statistical information about nodes in the cluster.

Examples:

Return statistics about JVM


client.nodes.stats metric: 'jvm'

Return statistics about field data structures for all fields


client.nodes.stats metric: 'indices', index_metric: 'fielddata', fields: '*', human: true

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,breaker,fs,http,indices,jvm,os,process,thread_pool,transport,discovery)

  • :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)

  • :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

  • :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)

See Also:



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

def stats(arguments={})
  arguments = arguments.clone
  node_id = arguments.delete(:node_id)

  path   = Utils.__pathify '_nodes',
                           Utils.__listify(node_id),
                           'stats',
                           Utils.__listify(arguments.delete(:metric)),
                           Utils.__listify(arguments.delete(:index_metric))

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

  [:completion_fields, :fielddata_fields, :fields, :groups, :types].each do |key|
    params[key] = Utils.__listify(params[key]) if params[key]
  end

  body   = nil

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

#usage(arguments = {}) ⇒ Object

The cluster nodes usage API allows to retrieve information on the usage of features for each node.

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,rest_actions)

  • :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

  • :timeout (Time)

    Explicit operation timeout

See Also:



14
15
16
17
18
19
20
21
# File 'lib/elasticsearch/api/actions/nodes/usage.rb', line 14

def usage(arguments={})
  method = Elasticsearch::API::HTTP_GET
  path   = "_nodes/usage"
  params = Elasticsearch::API::Utils.__validate_and_extract_params arguments, ParamsRegistry.get(__method__)
  body   = nil

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