-
Notifications
You must be signed in to change notification settings - Fork 1.2k
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
Tasks API failing with 8.17.1 (but not 8.15.2) #2765
Comments
Confirmed this also occurs in 8.16.0, so ostensibly every version between 8.16.0 and 8.17.1 is affected. |
Hello @untergeek, and thanks for opening this issue! As mentioned in the release notes, elasticsearch-py 8.16.0 and above emit warnings for tech preview and beta APIs. We added this because we did not want users to rely on such APIs without knowing they were not GA yet. Indeed, as of Elasticsearch 8.17, the tasks APIs are still in tech preview. However, the client code only emits a warning by using this decorator. Python allows turning warnings into exceptions, but it has to be explicitly configured to do so. The client is not doing this: elasticsearch-py/elasticsearch/__init__.py Lines 71 to 73 in e4a9563
(If it were |
See [the 8.16.0 Python client release notes](https://github.com/elastic/elasticsearch-py/releases/tag/v8.16.0) for the workaround. This exact fix is included now in src/es_wait/task.py I had initially raised an issue at elastic/elasticsearch-py#2765 to learn what transpired. ```diff --- a/src/es_wait/task.py +++ b/src/es_wait/task.py @@ -2,8 +2,10 @@ import typing as t import logging +import warnings from time import localtime, strftime from dotmap import DotMap # type: ignore +from elasticsearch8.exceptions import GeneralAvailabilityWarning from ._base import Waiter if t.TYPE_CHECKING: @@ -72,6 +74,10 @@ class Task(Waiter): response = {} try: + # The Tasks API is not yet GA. We need to suppress the warning for now. + # This is required after elasticsearch8>=8.16.0 as the warning is raised + # from that release onward. + warnings.filterwarnings("ignore", category=GeneralAvailabilityWarning) response = dict(self.client.tasks.get(task_id=self.task_id)) except Exception as err: msg = ( ```
Thank you for the context. This is indeed what I was bit by, but with it being the The workaround in the release notes did the trick. This issue can be closed, or left open for others to find. |
Problem call:
This call works fine in 8.15.2. But attempting the same in 8.17.1 raises an unknown exception and warning:
Not sure what's going on, but something that was working no longer is. Affected versions may include any between 8.15.2 and 8.17.1.
The text was updated successfully, but these errors were encountered: