Module: ElasticSearch::Api::Admin::Cluster

Included in:
Client
Defined in:
lib/elasticsearch/client/admin_cluster.rb

Constant Summary collapse

PSEUDO_NODES =
[:all, :local, :master]

Instance Method Summary collapse

Instance Method Details

#cluster_health(*args) ⇒ Object

list of indices, or all indices (default) options: level (cluster (default), indices, shards), wait_for_status, wait_for_relocating_shards, timeout



9
10
11
12
# File 'lib/elasticsearch/client/admin_cluster.rb', line 9

def cluster_health(*args)
  options = args.last.is_a?(Hash) ? args.pop : {}
  execute(:cluster_health, args.flatten, options)
end

#cluster_state(options = {}) ⇒ Object



14
15
16
# File 'lib/elasticsearch/client/admin_cluster.rb', line 14

def cluster_state(options={})
  execute(:cluster_state, options)
end

#nodes_info(*args) ⇒ Object

list of nodes, or all nodes (default) no options



20
21
22
23
# File 'lib/elasticsearch/client/admin_cluster.rb', line 20

def nodes_info(*args)
  options = args.last.is_a?(Hash) ? args.pop : {}
  execute(:nodes_info, args.flatten, options)
end

#nodes_stats(*args) ⇒ Object

list of nodes, or all nodes (default) no options



27
28
29
30
# File 'lib/elasticsearch/client/admin_cluster.rb', line 27

def nodes_stats(*args)
  options = args.last.is_a?(Hash) ? args.pop : {}
  execute(:nodes_stats, args.flatten, options)
end

#restart_nodes(*args) ⇒ Object

list of nodes, or :local, :master, :all if no nodes, then do nothing (to avoid accidental cluster shutdown) options: delay



46
47
48
49
50
51
52
# File 'lib/elasticsearch/client/admin_cluster.rb', line 46

def restart_nodes(*args)
  options = args.last.is_a?(Hash) ? args.pop : {}
  return false if args.empty?
  nodes = args.flatten
  nodes.collect! { |n| PSEUDO_NODES.include?(n) ? "_#{n}" : n }
  execute(:restart_nodes, nodes, options)
end

#shutdown_nodes(*args) ⇒ Object

list of nodes, or :local, :master, :all if no nodes, then do nothing (to avoid accidental cluster shutdown) options: delay



35
36
37
38
39
40
41
# File 'lib/elasticsearch/client/admin_cluster.rb', line 35

def shutdown_nodes(*args)
  options = args.last.is_a?(Hash) ? args.pop : {}
  return false if args.empty?
  nodes = args.flatten
  nodes.collect! { |n| PSEUDO_NODES.include?(n) ? "_#{n}" : n }
  execute(:shutdown_nodes, nodes, options)
end