Class: Chewy::ElasticClient
- Inherits:
-
Object
- Object
- Chewy::ElasticClient
- Defined in:
- lib/chewy/elastic_client.rb
Overview
Replacement for Chewy.client
Class Method Summary collapse
Instance Method Summary collapse
-
#initialize(elastic_client = self.class.build_es_client) ⇒ ElasticClient
constructor
A new instance of ElasticClient.
Constructor Details
#initialize(elastic_client = self.class.build_es_client) ⇒ ElasticClient
Returns a new instance of ElasticClient.
11 12 13 |
# File 'lib/chewy/elastic_client.rb', line 11 def initialize(elastic_client = self.class.build_es_client) @elastic_client = elastic_client end |
Dynamic Method Handling
This class handles dynamic methods through the method_missing method
#method_missing(name, *args, **kwargs, &block) ⇒ Object (private)
17 18 19 20 21 |
# File 'lib/chewy/elastic_client.rb', line 17 def method_missing(name, *args, **kwargs, &block) inspect_payload(name, args, kwargs) @elastic_client.__send__(name, *args, **kwargs, &block) end |
Class Method Details
.build_es_client(configuration = Chewy.configuration) ⇒ Object
4 5 6 7 8 9 |
# File 'lib/chewy/elastic_client.rb', line 4 def self.build_es_client(configuration = Chewy.configuration) client_configuration = configuration.deep_dup client_configuration.delete(:prefix) # used by Chewy, not relevant to Elasticsearch::Client block = client_configuration[:transport_options].try(:delete, :proc) ::Elasticsearch::Client.new(client_configuration, &block) end |