Module: ActiveRecord::ConnectionHandling

Defined in:
lib/active_record/connection_adapters/elasticsearch_adapter.rb

Overview

:nodoc:

Instance Method Summary collapse

Instance Method Details

#elasticsearch_connection(config) ⇒ Object



25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
# File 'lib/active_record/connection_adapters/elasticsearch_adapter.rb', line 25

def elasticsearch_connection(config)
  config          = config.symbolize_keys

  # move 'host' to 'hosts'
  config[:hosts]  = config.delete(:host) if config[:host]

  # enable logging (Rails.logger)
  config[:logger] = logger if config.delete(:log)

  ConnectionAdapters::ElasticsearchAdapter.new(
    ConnectionAdapters::ElasticsearchAdapter.new_client(config),
    logger,
    config
  )
end