lib/ej/values.rb in ej-0.1.9 vs lib/ej/values.rb in ej-0.1.10
- old
+ new
@@ -9,14 +9,19 @@
@logger.level = global_options[:debug] ? Logger::DEBUG : Logger::INFO
@client = get_client(global_options[:host], global_options[:index])
@index = global_options[:index]
end
- def get_client(host, index)
- host, port = host.split(':')
+ def get_client(host_string, index)
+ 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 }]
transport = ::Elasticsearch::Transport::Transport::HTTP::Faraday.new(
{
- hosts: [{ host: host, port: port }],
+ hosts: hosts,
options: {
reload_connections: true,
reload_on_failure: false,
retry_on_failure: 5,
transport_options: {