Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Per-query client configuation adjustments. #959

Open
andriytyurnikov opened this issue Jul 17, 2024 · 0 comments
Open

Per-query client configuation adjustments. #959

andriytyurnikov opened this issue Jul 17, 2024 · 0 comments

Comments

@andriytyurnikov
Copy link

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
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant