Skip to content

Per-query client configuation adjustments. #959

@andriytyurnikov

Description

@andriytyurnikov

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions