Skip to content

Conversation

@David-Botos
Copy link
Contributor

@David-Botos David-Botos commented Jan 21, 2026

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?

  • Bug Fix

Description

Fixed a configuration key mismatch in the Elasticsearch2 query runner that prevented successful connection testing.

Problem:
The ElasticSearch2 query runner in elasticsearch2.py was attempting to access self.configuration["server"], but the BaseHTTPQueryRunner parent 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.py to 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?

  • Manually

Manual Testing Process:

  1. Rebuilt the Redash Docker containers with the code changes using make compose_build
  2. Configured an Elasticsearch data source with valid connection credentials
  3. Clicked "Test Connection" button in the data source configuration UI
  4. Verified the connection test now succeeds (previously failed with 'server' error)
  5. Confirmed queries execute successfully against the connected Elasticsearch cluster

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.

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 getredash#7044
Copy link

@cubic-dev-ai cubic-dev-ai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No issues found across 1 file

Copy link
Contributor

@yoshiokatsuneo yoshiokatsuneo left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@David-Botos

Thank you for your contribution !

Actually, the issue looks being introduced by the PR . #6899 .

I confirmed that this PR fixed the issue by changing to use the correct "url" setting instead of wrong "server" setting.

@yoshiokatsuneo yoshiokatsuneo merged commit f7728ad into getredash:master Jan 24, 2026
12 checks passed
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

Successfully merging this pull request may close these issues.

unable to connect to Elasticsearch

2 participants