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鈥檒l occasionally send you account related emails.

Already on GitHub? Sign in to your account

elasticsearch[patch]: fix integration tests for release #18980

Merged
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
"""Test ElasticsearchRetriever functionality."""

import os
import re
import uuid
from typing import Any, Dict
Expand Down Expand Up @@ -77,11 +78,19 @@ def test_init_url(self, index_name: str) -> None:
def body_func(query: str) -> Dict:
return {"query": {"match": {text_field: {"query": query}}}}

es_url = os.environ.get("ES_URL", "http://localhost:9200")
cloud_id = os.environ.get("ES_CLOUD_ID")
api_key = os.environ.get("ES_API_KEY")

config = (
{"cloud_id": cloud_id, "api_key": api_key} if cloud_id else {"url": es_url}
)

retriever = ElasticsearchRetriever.from_es_params(
url="http://localhost:9200",
index_name=index_name,
body_func=body_func,
content_field=text_field,
**config, # type: ignore[arg-type]
)

index_test_data(retriever.es_client, index_name, text_field)
Expand Down