Class: Elastomer::Client::Nodes
- Inherits:
-
Object
- Object
- Elastomer::Client::Nodes
- Defined in:
- lib/elastomer/client/nodes.rb
Instance Attribute Summary collapse
-
#client ⇒ Object
readonly
Returns the value of attribute client.
-
#node_id ⇒ Object
readonly
Returns the value of attribute node_id.
Instance Method Summary collapse
-
#hot_threads(params = {}) ⇒ Object
Get the current hot threads on each node in the cluster.
-
#info(params = {}) ⇒ Object
Retrieve one or more (or all) of the cluster nodes information.
-
#initialize(client, node_id) ⇒ Nodes
constructor
Create a new nodes client for making API requests that pertain to the health and management individual nodes.
-
#shutdown(params = {}) ⇒ Object
Shutdown one or more nodes in the cluster.
-
#stats(params = {}) ⇒ Object
Retrieve one or more (or all) of the cluster nodes statistics.
-
#update_params(params, overrides = nil) ⇒ Object
Internal: Add default parameters to the ‘params` Hash and then apply `overrides` to the params if any are given.
Constructor Details
#initialize(client, node_id) ⇒ Nodes
Create a new nodes client for making API requests that pertain to the health and management individual nodes.
client - Elastomer::Client used for HTTP requests to the server node_id - The node ID as a String or an Array of node IDs
22 23 24 25 |
# File 'lib/elastomer/client/nodes.rb', line 22 def initialize( client, node_id ) @client = client @node_id = node_id end |
Instance Attribute Details
#client ⇒ Object (readonly)
Returns the value of attribute client.
27 28 29 |
# File 'lib/elastomer/client/nodes.rb', line 27 def client @client end |
#node_id ⇒ Object (readonly)
Returns the value of attribute node_id.
27 28 29 |
# File 'lib/elastomer/client/nodes.rb', line 27 def node_id @node_id end |
Instance Method Details
#hot_threads(params = {}) ⇒ Object
Get the current hot threads on each node in the cluster. See www.elasticsearch.org/guide/reference/api/admin-cluster-nodes-hot-threads/
params - Parameters Hash
Returns the response as a Hash
57 58 59 60 |
# File 'lib/elastomer/client/nodes.rb', line 57 def hot_threads( params = {} ) response = client.get '/_nodes{/node_id}/hot_threads', update_params(params, :action => 'nodes.hot_threads') response.body end |
#info(params = {}) ⇒ Object
Retrieve one or more (or all) of the cluster nodes information. See www.elasticsearch.org/guide/reference/api/admin-cluster-nodes-info/
params - Parameters Hash
Returns the response as a Hash
35 36 37 38 |
# File 'lib/elastomer/client/nodes.rb', line 35 def info( params = {} ) response = client.get '/_nodes{/node_id}', update_params(params, :action => 'nodes.info') response.body end |
#shutdown(params = {}) ⇒ Object
Shutdown one or more nodes in the cluster. See www.elasticsearch.org/guide/reference/api/admin-cluster-nodes-shutdown/
params - Parameters Hash
Returns the response as a Hash
68 69 70 71 |
# File 'lib/elastomer/client/nodes.rb', line 68 def shutdown( params = {} ) response = client.post '/_cluster/nodes{/node_id}/_shutdown', update_params(params, :action => 'nodes.shutdown') response.body end |
#stats(params = {}) ⇒ Object
Retrieve one or more (or all) of the cluster nodes statistics. See www.elasticsearch.org/guide/reference/api/admin-cluster-nodes-stats/
params - Parameters Hash
Returns the response as a Hash
46 47 48 49 |
# File 'lib/elastomer/client/nodes.rb', line 46 def stats( params = {} ) response = client.get '/_nodes{/node_id}/stats', update_params(params, :action => 'nodes.stats') response.body end |
#update_params(params, overrides = nil) ⇒ Object
Internal: Add default parameters to the ‘params` Hash and then apply `overrides` to the params if any are given.
params - Parameters Hash overrides - Optional parameter overrides as a Hash
Returns a new params Hash.
80 81 82 83 84 |
# File 'lib/elastomer/client/nodes.rb', line 80 def update_params( params, overrides = nil ) h = { :node_id => node_id }.update params h.update overrides unless overrides.nil? h end |