Module: Elasticsearch::API::Cluster::Actions
- Included in:
- ClusterClient
- Defined in:
- lib/elasticsearch/api/namespace/cluster.rb,
lib/elasticsearch/api/actions/cluster/state.rb,
lib/elasticsearch/api/actions/cluster/health.rb,
lib/elasticsearch/api/actions/cluster/reroute.rb,
lib/elasticsearch/api/actions/cluster/node_info.rb,
lib/elasticsearch/api/actions/cluster/node_stats.rb,
lib/elasticsearch/api/actions/cluster/get_settings.rb,
lib/elasticsearch/api/actions/cluster/put_settings.rb,
lib/elasticsearch/api/actions/cluster/node_shutdown.rb,
lib/elasticsearch/api/actions/cluster/pending_tasks.rb,
lib/elasticsearch/api/actions/cluster/node_hot_threads.rb
Instance Method Summary collapse
-
#get_settings(arguments = {}) ⇒ Object
Get the cluster settings (previously set with #put_settings).
-
#health(arguments = {}) ⇒ Object
Returns information about cluster “health”.
-
#node_hot_threads(arguments = {}) ⇒ String
Returns information about the hottest threads in the cluster or on a specific node as a String.
-
#node_info(arguments = {}) ⇒ Object
Returns information about nodes in the cluster (cluster settings, JVM version, etc).
-
#node_shutdown(arguments = {}) ⇒ Object
Shutdown one or all nodes.
-
#node_stats(arguments = {}) ⇒ Object
Returns statistical information about nodes in the cluster.
-
#pending_tasks(arguments = {}) ⇒ Object
Returns a list of any cluster-level changes (e.g. create index, update mapping, allocate or fail shard) which have not yet been executed and are queued up.
-
#put_settings(arguments = {}) ⇒ Object
Update cluster settings.
-
#reroute(arguments = {}) ⇒ Object
Perform manual shard allocation in the cluster.
-
#state(arguments = {}) ⇒ Object
Get information about the cluster state (indices settings, allocations, etc).
Instance Method Details
#get_settings(arguments = {}) ⇒ Object
Get the cluster settings (previously set with #put_settings)
16 17 18 19 20 21 22 23 24 25 26 27 |
# File 'lib/elasticsearch/api/actions/cluster/get_settings.rb', line 16 def get_settings(arguments={}) valid_params = [ :flat_settings ] method = 'GET' path = "_cluster/settings" params = Utils.__validate_and_extract_params arguments, valid_params body = nil perform_request(method, path, params, body).body end |
#health(arguments = {}) ⇒ Object
Returns information about cluster “health”.
28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 |
# File 'lib/elasticsearch/api/actions/cluster/health.rb', line 28 def health(arguments={}) valid_params = [ :level, :local, :master_timeout, :timeout, :wait_for_active_shards, :wait_for_nodes, :wait_for_relocating_shards, :wait_for_status ] method = 'GET' path = "_cluster/health" params = Utils.__validate_and_extract_params arguments, valid_params body = nil perform_request(method, path, params, body).body end |
#node_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.
28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 |
# File 'lib/elasticsearch/api/actions/cluster/node_hot_threads.rb', line 28 def node_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 |
#node_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).
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/cluster/node_info.rb', line 34 def node_info(arguments={}) valid_params = [ :all, :clear, :http, :jvm, :network, :os, :plugin, :process, :settings, :thread_pool, :transport ] method = 'GET' path = Utils.__pathify '_nodes', Utils.__listify(arguments[:node_id]) params = Utils.__validate_and_extract_params arguments, valid_params body = nil perform_request(method, path, params, body).body end |
#node_shutdown(arguments = {}) ⇒ Object
Shutdown one or all nodes
20 21 22 23 24 25 26 27 28 29 30 31 32 |
# File 'lib/elasticsearch/api/actions/cluster/node_shutdown.rb', line 20 def node_shutdown(arguments={}) valid_params = [ :delay, :exit ] method = 'POST' path = Utils.__pathify '_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 |
#node_stats(arguments = {}) ⇒ Object
Returns statistical information about nodes in the cluster.
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 58 59 60 61 62 63 64 65 66 67 68 69 70 71 |
# File 'lib/elasticsearch/api/actions/cluster/node_stats.rb', line 33 def node_stats(arguments={}) valid_params = [ :all, :clear, :fields, :fs, :http, :indices, :jvm, :network, :os, :process, :thread_pool, :transport ] method = 'GET' case # Field data metric for the `indices` metric family when arguments[:indices] && arguments[:metric] == 'fielddata' path = Utils.__pathify '_nodes', Utils.__listify(arguments[:node_id]), 'stats/indices/fielddata' params = { :fields => Utils.__listify(arguments[:fields]) } # `indices` metric family incl. a metric when arguments[:indices] && arguments[:metric] path = Utils.__pathify( '_nodes', Utils.__listify(arguments[:node_id]), 'stats/indices', arguments[:metric] ) params = {} else path = Utils.__pathify( '_nodes', Utils.__listify(arguments[:node_id]), 'stats' ) params = Utils.__validate_and_extract_params arguments, valid_params params[:fields] = Utils.__listify(params[:fields]) if params[:fields] end body = nil perform_request(method, path, params, body).body end |
#pending_tasks(arguments = {}) ⇒ Object
Returns a list of any cluster-level changes (e.g. create index, update mapping, allocate or fail shard) which have not yet been executed and are queued up.
19 20 21 22 23 24 25 26 27 28 29 |
# File 'lib/elasticsearch/api/actions/cluster/pending_tasks.rb', line 19 def pending_tasks(arguments={}) valid_params = [ :local, :master_timeout ] method = 'GET' path = "/_cluster/pending_tasks" params = Utils.__validate_and_extract_params arguments, valid_params body = nil perform_request(method, path, params, body).body end |
#put_settings(arguments = {}) ⇒ Object
Update cluster settings.
17 18 19 20 21 22 23 24 |
# File 'lib/elasticsearch/api/actions/cluster/put_settings.rb', line 17 def put_settings(arguments={}) method = 'PUT' path = "_cluster/settings" params = {} body = arguments[:body] || {} perform_request(method, path, params, body).body end |
#reroute(arguments = {}) ⇒ Object
If you want to explicitely set the shard allocation to a certain node, you might want to look at the ‘allocation.*` cluster settings.
Perform manual shard allocation in the cluster.
Pass the operations you want to perform in the ‘:body` option. Use the `dry_run` option to evaluate the result of operations without actually performing them.
28 29 30 31 32 33 34 35 36 37 38 |
# File 'lib/elasticsearch/api/actions/cluster/reroute.rb', line 28 def reroute(arguments={}) valid_params = [ :dry_run, :filter_metadata ] method = 'POST' path = "_cluster/reroute" params = Utils.__validate_and_extract_params arguments, valid_params body = arguments[:body] || {} perform_request(method, path, params, body).body end |
#state(arguments = {}) ⇒ Object
Get information about the cluster state (indices settings, allocations, etc)
25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 |
# File 'lib/elasticsearch/api/actions/cluster/state.rb', line 25 def state(arguments={}) valid_params = [ :filter_blocks, :filter_index_templates, :filter_indices, :filter_metadata, :filter_nodes, :filter_routing_table, :local, :master_timeout ] method = 'GET' path = "_cluster/state" params = Utils.__validate_and_extract_params arguments, valid_params body = nil perform_request(method, path, params, body).body end |