-
Notifications
You must be signed in to change notification settings - Fork 127
API key, secure connections, and further small changes to Elastic connection wrapper #103
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
Closed
Closed
Changes from all commits
Commits
Show all changes
9 commits
Select commit
Hold shift + click to select a range
100bf97
Enabled api key elastic connections
filipecosta90 6549035
Fixes per pre-commit hook
filipecosta90 3f314d8
popping the parallel config from a deep copy of search_params
filipecosta90 213e6eb
Merge remote-tracking branch 'qdrant/master' into elastic.cloud
filipecosta90 6bd120f
Update engine/clients/elasticsearch/config.py
filipecosta90 d976cf6
Update engine/clients/elasticsearch/config.py
filipecosta90 06ac0f8
Update engine/clients/elasticsearch/config.py
filipecosta90 9751080
Removed api_key usage per review
filipecosta90 5d7e517
Enable specifying the elastic index timeouts. disabled ssl warnings
filipecosta90 File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,4 +1,52 @@ | ||
| ELASTIC_PORT = 9200 | ||
| ELASTIC_INDEX = "bench" | ||
| ELASTIC_USER = "elastic" | ||
| ELASTIC_PASSWORD = "passwd" | ||
| import os | ||
| import time | ||
|
|
||
| import urllib3 | ||
| from elasticsearch import Elasticsearch | ||
|
|
||
| ELASTIC_PORT = int(os.getenv("ELASTIC_PORT", 9200)) | ||
| ELASTIC_INDEX = os.getenv("ELASTIC_INDEX", "bench") | ||
| ELASTIC_USER = os.getenv("ELASTIC_USER", "elastic") | ||
| ELASTIC_PASSWORD = os.getenv("ELASTIC_PASSWORD", "passwd") | ||
| ELASTIC_TIMEOUT = int(os.getenv("ELASTIC_TIMEOUT", 300)) | ||
| ELASTIC_INDEX_TIMEOUT = os.getenv("ELASTIC_INDEX_TIMEOUT", "30m") | ||
| ELASTIC_INDEX_REFRESH_INTERVAL = os.getenv("ELASTIC_INDEX_REFRESH_INTERVAL", "-1") | ||
| urllib3.disable_warnings(urllib3.exceptions.InsecureRequestWarning) | ||
|
|
||
|
|
||
| def get_es_client(host, connection_params): | ||
| client: Elasticsearch = None | ||
| init_params = { | ||
| **{ | ||
| "verify_certs": False, | ||
| "request_timeout": ELASTIC_TIMEOUT, | ||
| "retry_on_timeout": True, | ||
| "ssl_show_warn": False, | ||
| }, | ||
| **connection_params, | ||
| } | ||
| if host.startswith("http"): | ||
| url = "" | ||
| else: | ||
| url = "http://" | ||
| url += f"{host}:{ELASTIC_PORT}" | ||
| client = Elasticsearch( | ||
| url, | ||
| basic_auth=(ELASTIC_USER, ELASTIC_PASSWORD), | ||
| **init_params, | ||
| ) | ||
| assert client.ping() | ||
| return client | ||
|
|
||
|
|
||
| def _wait_for_es_status(client, status="yellow"): | ||
| print(f"waiting for ES {status} status...") | ||
| for _ in range(100): | ||
| try: | ||
| client.cluster.health(wait_for_status=status) | ||
| return client | ||
| except ConnectionError: | ||
| time.sleep(0.1) | ||
| else: | ||
| # timeout | ||
| raise Exception("Elasticsearch failed to start.") | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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.
Uh oh!
There was an error while loading. Please reload this page.