chewy
chewy copied to clipboard
Per-query client configuation adjustments.
Per-call client configuation adjustments.
When many queries are invoked in many parts of an app, it seems challenging to have a customised value of request_timeout
per query, as client instance is set on first invocation in a thread.
Ability to override client parameters per query call seems like a straightforward solution
Additional context
# Main elasticsearch-ruby client instance
#
def client
Thread.current[:chewy_client] ||= begin
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
end