Module: EsClient

Defined in:
lib/es_client.rb,
lib/es_client/index.rb,
lib/es_client/client.rb,
lib/es_client/logger.rb,
lib/es_client/version.rb,
lib/es_client/response.rb,
lib/es_client/active_record/glue.rb,
lib/es_client/active_record/adapter.rb,
lib/es_client/active_record/shortcuts.rb

Defined Under Namespace

Modules: ActiveRecord Classes: Client, Index, Logger, Response

Constant Summary collapse

VERSION =
'0.2.0'
@@host =
'http://localhost:9200'
@@http_client_options =
{persistent: true}
@@logger_options =
{log_binary: true, log_response: true, pretty: true}
@@callbacks_enabled =
true

Class Method Summary collapse

Class Method Details

.clientObject



28
29
30
# File 'lib/es_client.rb', line 28

def self.client
  @client ||= ::EsClient::Client.new(host, http_client_options)
end

.log_path=(path) ⇒ Object



24
25
26
# File 'lib/es_client.rb', line 24

def self.log_path=(path)
  self.logger = ::EsClient::Logger.new(path, logger_options)
end

.setup {|_self| ... } ⇒ Object

Yields:

  • (_self)

Yield Parameters:

  • _self (EsClient)

    the object that the method was called on



42
43
44
# File 'lib/es_client.rb', line 42

def self.setup
  yield self
end

.with_log_level(level) ⇒ Object



32
33
34
35
36
37
38
39
40
# File 'lib/es_client.rb', line 32

def self.with_log_level(level)
  old_level = logger.level
  begin
    self.logger.level = level.is_a?(Integer) ? level : logger.class.const_get(level.to_s.upcase)
    yield
  ensure
    self.logger.level = old_level
  end
end