Class: ElasticSearch::Transport::HTTP

Inherits:
Base
  • Object
show all
Defined in:
lib/elasticsearch/transport/http.rb

Constant Summary collapse

DEFAULTS =
{
  :timeout => 5
}.freeze

Instance Attribute Summary

Attributes inherited from Base

#options, #server

Instance Method Summary collapse

Methods inherited from Base

#close, #encoder

Methods included from BaseProtocol

#all_nodes

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

#initialize(server, options = {}) ⇒ HTTP

Returns a new instance of HTTP.



12
13
14
15
# File 'lib/elasticsearch/transport/http.rb', line 12

def initialize(server, options={})
  super
  @options = DEFAULTS.merge(@options)
end

Instance Method Details

#connect!Object



17
18
19
20
21
22
# File 'lib/elasticsearch/transport/http.rb', line 17

def connect!
  @session = Patron::Session.new
  @session.base_url = @server
  @session.timeout = @options[:timeout]
  @session.headers['User-Agent'] = 'ElasticSearch.rb v0.1'
end