class LogStash::Outputs::ElasticSearchJavaPlugins::Protocols::TransportClient
Private Instance Methods
clear_client()
click to toggle source
# File lib/logstash/outputs/elasticsearch_java/protocol.rb, line 235 def clear_client() client_mutex_synchronize { @client = nil } end
client()
click to toggle source
We want a separate client per instance for transport
# File lib/logstash/outputs/elasticsearch_java/protocol.rb, line 231 def client client_mutex_synchronize { @client ||= make_client } end
make_client()
click to toggle source
# File lib/logstash/outputs/elasticsearch_java/protocol.rb, line 209 def make_client builder = org.elasticsearch.client.transport.TransportClient.builder() client = client_options[:elasticsearch_plugins].reduce(builder) do |b,plugin_class| b.add_plugin(plugin_class) end.settings((settings.build)).build() client_options[:hosts].each do |host| matches = host.match /([^:+]+)(:(\d+))?/ inet_addr = java.net.InetAddress.getByName(matches[1]) port = (matches[3] || 9300).to_i client.addTransportAddress( org.elasticsearch.common.transport.InetSocketTransportAddress.new( inet_addr, port ) ) end return client end