lib/ej/values.rb in ej-0.1.12 vs lib/ej/values.rb in ej-0.2.0
- old
+ new
@@ -10,28 +10,10 @@
@client = get_client(global_options[:host], global_options[:index], global_options[:user], global_options[:password])
@index = global_options[:index]
end
def get_client(host_string, index, user, password)
- host, port = (host_string || DEFAULT_HOST), DEFAULT_PORT
- if !host_string.nil? && host_string.include?(":")
- host, port = host_string.split(':')
- end
-
- hosts = [{ host: host, port: port, user: user, password: password }]
- transport = ::Elasticsearch::Transport::Transport::HTTP::Faraday.new(
- {
- hosts: hosts,
- options: {
- reload_connections: true,
- reload_on_failure: false,
- retry_on_failure: 5,
- transport_options: {
- request: { timeout: 300 }
- }
- }
- }
- )
- ::Elasticsearch::Client.new transport: transport, index: index, logger: @logger
+ hosts = Util.parse_hosts(host_string, user, password)
+ ::Elasticsearch::Client.new transport: Util.get_transport(hosts), index: index, logger: @logger
end
end
end