module Elasticsearch::API::Nodes::Actions

Public Instance Methods

hot_threads(arguments={}) click to toggle source

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.

@example Return 10 hottest threads

client.nodes.hot_threads threads: 10

@option arguments [List] :node_id 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

@option arguments [Time] :interval The interval for the second sampling of threads @option arguments [Number] :snapshots Number of samples of thread stacktrace (default: 10) @option arguments [Number] :threads Specify the number of threads to provide information for (default: 3) @option arguments [String] :type The type to sample (default: cpu) (options: cpu, wait, block)

@return [String]

@see www.elasticsearch.org/guide/reference/api/admin-cluster-nodes-hot-threads/

# File lib/elasticsearch/api/actions/nodes/hot_threads.rb, line 28
def hot_threads(arguments={})
  valid_params = [
    :interval,
    :snapshots,
    :threads,
    :type ]

  method = HTTP_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={}) click to toggle source

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).

@example Return information about JVM

client.nodes.info jvm: true

@example Return information about HTTP and network

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

@example Pass a list of metrics

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

@option arguments [List] :node_id 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

@option arguments [Boolean] :_all Return all available information @option arguments [Boolean] :http Return information about HTTP @option arguments [Boolean] :jvm Return information about the JVM @option arguments [Boolean] :network Return information about network @option arguments [Boolean] :os Return information about the operating system @option arguments [Boolean] :plugins Return information about plugins @option arguments [Boolean] :process Return information about the Elasticsearch process @option arguments [Boolean] :settings Return information about node settings @option arguments [Boolean] :thread_pool Return information about the thread pool @option arguments [Boolean] :transport Return information about transport

@see elasticsearch.org/guide/reference/api/admin-cluster-nodes-info/

# File lib/elasticsearch/api/actions/nodes/info.rb, line 41
def info(arguments={})
  arguments = arguments.clone
  metric    = arguments.delete(:metric)

  valid_parts = [
    :_all,
    :http,
    :jvm,
    :network,
    :os,
    :plugins,
    :process,
    :settings,
    :thread_pool,
    :transport ]

  valid_params = []

  method = HTTP_GET

  if metric
    parts = metric
  else
    parts = Utils.__extract_parts arguments, valid_parts
  end

  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={}) click to toggle source

Shutdown one or all nodes

@example Shut down node named Bloke

client.nodes.shutdown node_id: 'Bloke'

@option arguments [List] :node_id 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

@option arguments [Time] :delay Set the delay for the operation (default: 1s) @option arguments [Boolean] :exit Exit the JVM as well (default: true)

@see elasticsearch.org/guide/reference/api/admin-cluster-nodes-shutdown/

# File lib/elasticsearch/api/actions/nodes/shutdown.rb, line 20
def shutdown(arguments={})
  valid_params = [
    :delay,
    :exit ]

  method = HTTP_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={}) click to toggle source

Returns statistical information about nodes in the cluster.

@example Return statistics about JVM

client.nodes.stats metric: 'jvm'

@example Return statistics about field data structures for all fields

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

@option arguments [List] :metric Limit the information returned to the specified metrics

(options: _all, breaker, fs, http, indices, jvm, network,
os, process, thread_pool, transport)

@option arguments [List] :index_metric Limit the information returned for the `indices` metric

      to the specified index metrics. Used only when
      `indices` or `all` metric is specified.
(options: _all, completion, docs, fielddata, filter_cache, flush, get,
id_cache, indexing, merge, percolate, refresh, search, segments, store,
warmer)

@option arguments [List] :node_id 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

@option arguments [List] :completion_fields A comma-separated list of fields for `fielddata` and `suggest`

index metrics (supports wildcards)

@option arguments [List] :fielddata_fields A comma-separated list of fields for `fielddata` index metric

(supports wildcards)

@option arguments [List] :fields A comma-separated list of fields for `fielddata` and `completion` index

metrics (supports wildcards)

@option arguments [Boolean] :groups A comma-separated list of search groups for `search` index metric @option arguments [Boolean] :human Whether to return time and byte values in human-readable format @option arguments [String] :level Specify the level for aggregating indices stats

(options: node, indices, shards)

@option arguments [List] :types A comma-separated list of document types for the `indexing` index metric

@see www.elasticsearch.org/guide/en/elasticsearch/reference/master/cluster-nodes-stats.html

# 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 = HTTP_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