Class: ElasticSearch::Transport::Thrift
- Defined in:
- lib/elasticsearch/transport/thrift.rb
Constant Summary collapse
- DEFAULTS =
{ :timeout => 5, :thrift_protocol => ::Thrift::BinaryProtocol, :thrift_protocol_extra_params => [], :thrift_transport => ::Thrift::Socket, :thrift_transport_wrapper => ::Thrift::BufferedTransport, :client_class => ElasticSearch::Thrift::Rest::Client }.freeze
Instance Attribute Summary
Attributes inherited from Base
Instance Method Summary collapse
- #close ⇒ Object
- #connect! ⇒ Object
-
#initialize(server, options = {}) ⇒ Thrift
constructor
A new instance of Thrift.
Methods inherited from Base
Methods included from BaseProtocol
Methods included from ClusterAdminProtocol
#cluster_health, #cluster_state, #nodes_info, #nodes_stats, #restart_nodes, #shutdown_nodes
Methods included from IndexAdminProtocol
#alias_index, #create_index, #delete_index, #flush, #index_status, #optimize, #refresh, #snapshot, #update_mapping
Methods included from IndexProtocol
#count, #delete, #get, #index, #scroll, #search
Constructor Details
Instance Method Details
#close ⇒ Object
36 37 38 |
# File 'lib/elasticsearch/transport/thrift.rb', line 36 def close @transport.close rescue nil end |
#connect! ⇒ Object
23 24 25 26 27 28 29 30 31 32 33 34 |
# File 'lib/elasticsearch/transport/thrift.rb', line 23 def connect! host, port = parse_server(@server) @transport = @options[:thrift_transport].new(host, port.to_i, @options[:timeout]) @transport = @transport_wrapper.new(@transport) if @transport_wrapper @transport.open @client = @options[:client_class].new(@options[:thrift_protocol].new(@transport, *@options[:thrift_protocol_extra_params])) rescue ::Thrift::TransportException, Errno::ECONNREFUSED close raise ConnectionFailed end |