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

ElasticsearchDocumentStore with header returns got multiple values for keyword argument 'headers' #1149

Open
yusyel opened this issue Oct 21, 2024 · 0 comments
Labels
bug Something isn't working integration:elasticsearch

Comments

@yusyel
Copy link

yusyel commented Oct 21, 2024

Describe the bug
Getting header token from google.oauth2 & service account and passing ElasticsearchDocumentStore headers arg returns:

TypeError: elasticsearch.Elasticsearch() got multiple values for keyword argument 'headers'

Code:

def get_token():
    credentials = service_account.IDTokenCredentials.from_service_account_file(
        SERVICE_ACCOUNT_FILE, target_audience=SEARCH)
    request = google.auth.transport.requests.Request()
    credentials.refresh(request)
    token = credentials.token
    header = {
    'Authorization': f'Bearer {token}'
    }
    return header

ElasticsearchDocumentStore(hosts = SEARCH, embedding_similarity_function="cosine", index=index_name, headers=header)

I tested with Elasticsearch client same header works.

However, just passing token to bearer_auth works. Which I used in my project.

Describe your environment (please complete the following information):

  • OS: debian
  • Haystack version: haystack 2.6.0
  • Integration version: elasticsearch-haystack 1.0.0
@yusyel yusyel added the bug Something isn't working label Oct 21, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working integration:elasticsearch
Projects
None yet
Development

No branches or pull requests

2 participants