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/shutdown.rb,
lib/elasticsearch/api/actions/nodes/hot_threads.rb

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)

  • :type (String)

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

Returns:

  • (String)

See Also:



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

def hot_threads(arguments={})
  valid_params = [
    :interval,
    :snapshots,
    :threads,
    :type ]

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

  params = Utils.__validate_and_extract_params arguments, valid_params
  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

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

See Also:



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
# File 'lib/elasticsearch/api/actions/nodes/info.rb', line 33

def info(arguments={})
  valid_parts = [
    :_all,
    :http,
    :jvm,
    :network,
    :os,
    :plugins,
    :process,
    :settings,
    :thread_pool,
    :transport ]

  valid_params = []

  method = 'GET'

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

  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:



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

def shutdown(arguments={})
  valid_params = [
    :delay,
    :exit ]

  method = 'POST'
  path   = Utils.__pathify '_cluster/nodes', Utils.__listify(arguments[:node_id]), '_shutdown'

  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.

(options: _all, completion, docs, fielddata, filter_cache, flush, get,
id_cache, indexing, merge, percolate, refresh, search, segments, store,
warmer)

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, network, os, process, thread_pool, transport)

  • :index_metric (List)

    Limit the information returned for the ‘indices` metric to the specified index metrics. Used only when `indices` or `all` metric is specified.

  • :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 metrics (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 metrics (supports wildcards)

  • :groups (Boolean)

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

  • :human (Boolean)

    Whether to return time and byte values in human-readable format

  • :level (String)

    Specify the level for aggregating indices stats (options: node, indices, shards)

  • :types (List)

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

See Also:



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
70
71
72
73
74
75
# File 'lib/elasticsearch/api/actions/nodes/stats.rb', line 43

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

  valid_params = [
    :metric,
    :index_metric,
    :node_id,
    :completion_fields,
    :fielddata_fields,
    :fields,
    :groups,
    :human,
    :level,
    :types ]

  method = 'GET'

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

  params = Utils.__validate_and_extract_params arguments, valid_params

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

  body   = nil

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