Skip to content

Fix ES_API_KEY to use native elasticsearch-py api_key parameter#598

Open
safaksm wants to merge 2 commits intostac-utils:mainfrom
AQUAVIEW-DAH:fix/es-api-key-auth
Open

Fix ES_API_KEY to use native elasticsearch-py api_key parameter#598
safaksm wants to merge 2 commits intostac-utils:mainfrom
AQUAVIEW-DAH:fix/es-api-key-auth

Conversation

@safaksm
Copy link

@safaksm safaksm commented Feb 8, 2026

Related Issue(s):

  • None

Description:

ES_API_KEY authentication was nonfunctional. The previous implementation set an x-api-key header, which is not recognized by Elasticsearch. This PR uses the native api_key parameter in elasticsearch-py, which correctly sends the Authorization: ApiKey header.

Also guards http_auth so both auth methods aren't set simultaneously (elasticsearch-py raises ValueError when multiple auth methods are configured).

PR Checklist:

  • Code is formatted and linted (run pre-commit run --all-files)
  • Tests pass (run make test)
  • Documentation has been updated to reflect changes, if applicable
  • Changes are added to the changelog

Safak Yamali added 2 commits February 7, 2026 17:29
The ES_API_KEY env var was injecting an x-api-key HTTP header, which
Elasticsearch ignores. Replace with the native api_key constructor
parameter that sends the correct Authorization: ApiKey header.

Also guard basic auth (ES_USER/ES_PASS) so it is skipped when api_key
is configured, since elasticsearch-py 8.x raises ValueError when
multiple auth methods are provided.
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.

1 participant