Module: Estool::Connections

Defined in:
lib/estool/connections.rb

Class Method Summary collapse

Class Method Details

.start_conn(host, port) ⇒ Object



7
8
9
# File 'lib/estool/connections.rb', line 7

def self.start_conn(host,port)
  Elasticsearch::Client.new host: "#{host}:#{port}"
end

.test_conn(client) ⇒ Object



11
12
13
14
15
16
17
18
19
# File 'lib/estool/connections.rb', line 11

def self.test_conn(client)
  begin
    client.perform_request 'GET', '_cluster/health'
  rescue Faraday::ConnectionFailed => connfail
    # Connection Failure Message
    puts connfail
    exit 1
  end
end