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 = {}) ⇒ String

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

Returns:

  • (String)

See Also:



32
33
34
35
36
37
38
39
40
# File 'lib/elasticsearch/api/actions/nodes/hot_threads.rb', line 32

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

  • :_all (Boolean)

    Return all available information

  • :http (Boolean)

    Return information about HTTP

  • :jvm (Boolean)

    Return information about the JVM

  • :network (Boolean)

    Return information about network

  • :os (Boolean)

    Return information about the operating system

  • :plugins (Boolean)

    Return information about plugins

  • :process (Boolean)

    Return information about the Elasticsearch process

  • :settings (Boolean)

    Return information about node settings

  • :thread_pool (Boolean)

    Return information about the thread pool

  • :transport (Boolean)

    Return information about transport

  • :flat_settings (Boolean)

    Return settings in flat format (default: false)

  • :timeout (Time)

    Explicit operation timeout

See Also:



47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
# File 'lib/elasticsearch/api/actions/nodes/info.rb', line 47

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 (Array)

    A comma-separated list of node IDs or names to perform the operation on

  • :timeout (String)

    Explicit operation timeout

See Also:



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

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

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



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

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.

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:



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

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