Fix Elasticsearch connector configuration key mismatch #7607
+1
−1
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
The Elasticsearch2 query runner was looking for configuration['server'] but BaseHTTPQueryRunner defines the schema field as 'url'. This caused a KeyError that manifested as 'Connection Test Failed: server'.
Fixes #7044
What type of PR is this?
Description
Fixed a configuration key mismatch in the Elasticsearch2 query runner that prevented successful connection testing.
Problem:
The
ElasticSearch2query runner inelasticsearch2.pywas attempting to accessself.configuration["server"], but theBaseHTTPQueryRunnerparent class defines this configuration field as"url"in its schema. This mismatch caused a KeyError when attempting to connect, which manifested to users as the error message:Connection Test Failed: 'server'.Solution:
Updated line 48 in
redash/query_runner/elasticsearch2.pyto use the correct configuration key:Before:
url = "{}{}".format(self.configuration["server"], url)
After:
url = "{}{}".format(self.configuration["url"], url)
This aligns the Elasticsearch connector implementation with the configuration schema defined in its parent class
BaseHTTPQueryRunner.Compatibility:
Tested with Elasticsearch 8.18.0. This fix applies to all Elasticsearch versions as it corrects the configuration schema alignment.
How is this tested?
Manual Testing Process:
make compose_build'server'error)Related Tickets & Documents
Fixes #7044
Mobile & Desktop Screenshots/Recordings (if there are UI changes)
N/A - This is a backend-only fix with no UI changes.