class Chewy::ElasticClient
Replacement for Chewy.client
Public Class Methods
build_es_client(configuration = Chewy.configuration)
click to toggle source
# 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
new(elastic_client = self.class.build_es_client)
click to toggle source
# File lib/chewy/elastic_client.rb, line 11 def initialize(elastic_client = self.class.build_es_client) @elastic_client = elastic_client end
Private Instance Methods
inspect_payload(name, args, kwargs)
click to toggle source
# File lib/chewy/elastic_client.rb, line 27 def inspect_payload(name, args, kwargs) Chewy.config.before_es_request_filter&.call(name, args, kwargs) end
method_missing(name, *args, **kwargs, &block)
click to toggle source
# 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
respond_to_missing?(name, _include_private = false)
click to toggle source
Calls superclass method
# File lib/chewy/elastic_client.rb, line 23 def respond_to_missing?(name, _include_private = false) @elastic_client.respond_to?(name) || super end