Module: Elastics::Client::Cluster
- Defined in:
- lib/elastics/client/cluster.rb
Defined Under Namespace
Classes: NoAliveHosts
Instance Method Summary collapse
Instance Method Details
#discover_cluster ⇒ Object
10 11 12 13 14 15 16 17 18 19 20 |
# File 'lib/elastics/client/cluster.rb', line 10 def discover_cluster # `nothing` allows not to fetch all unnecessary data discovered = request(index: '_nodes', type: '_all', id: 'nothing')['nodes']. map { |id, node| match = node['http_address'].match(/inet\[.*?\/([\da-f.:]+)/i) match && match[1] }.compact @cluster_mutex.synchronize do @hosts.clear.concat(discovered - @dead_hosts.keys) end end |