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

Calling options() on a client resets timeout related attributes #1947

Closed
redbaron4 opened this issue Mar 29, 2022 · 4 comments · Fixed by #2030
Closed

Calling options() on a client resets timeout related attributes #1947

redbaron4 opened this issue Mar 29, 2022 · 4 comments · Fixed by #2030
Assignees

Comments

@redbaron4
Copy link

Elasticsearch version (8.1.1):

elasticsearch-py version (8.1.1):

Please make sure the major version matches the Elasticsearch server you are running.

Description of the problem including expected versus actual behavior:

When the options() method is called for an existing ElasticSearch client instance, the timeout related parameters are not preserved. These parameters are:

  • self._request_timeout
  • self._max_retries
  • self._retry_on_timeout
  • self._retry_on_status

This is problematic in the helpers module, particularly scan() because that method calls the options and resets any timeout related settings we may have made on the client. We can re-specify the request_timeout there but retries parameters cannot be replicated

Steps to reproduce:

>>> import elasticsearch as ES
>>> es=ES.Elasticsearch("http://esmasters:9200", sniff_on_connection_fail=True, sniff_on_start=True, min_delay_between_sniffing=600, request_timeout=600, sniff_timeout=300, max_retries=5, retry_on_timeout=True)
>>> es._retry_on_timeout
True
>>> es2=es.options()
>>> es2._retry_on_timeout
<DEFAULT>
>>> es._max_retries
5
>>> es2._max_retries
<DEFAULT>
>>> es2._retry_on_status
<DEFAULT>
>>> es._retry_on_status
<DEFAULT>
>>> es._request_timeout
600
>>> es2._request_timeout
<DEFAULT>
@sethmlarson
Copy link
Contributor

Thanks for reporting this, this does seem like something worth fixing. Let me take a look.

@mwbenowitz
Copy link

+1 to this. It's called in the streaming_bulk method as well, and I believe it is not possible to re-specify any of the affected parameters at that point (most importantly request_timeout)

@meganvw
Copy link

meganvw commented May 20, 2022

Yes +1 it would be great to see this fixed - ran into this problem today

@itayB
Copy link
Contributor

itayB commented Apr 10, 2023

Assuming you guys used the retry_on_timeout in bulk operations, I wonder if you also faced this issue (value propagate but retries never happen)

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 a pull request may close this issue.

6 participants