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

Query timeout not working as expected #986

Closed
bobbyi opened this issue Jul 25, 2019 · 2 comments
Closed

Query timeout not working as expected #986

bobbyi opened this issue Jul 25, 2019 · 2 comments
Assignees

Comments

@bobbyi
Copy link

bobbyi commented Jul 25, 2019

I am in the process of upgrading our cluster and client from ES 6.1.2 to ES 7.2 and have ran into some confusion regarding timeout settings with the Python client.

I have reduced down to a case where I create my client like this:
client = Elasticsearch([{'host': host, 'port': 9200}], timeout=60*60*5, max_retries=0, retry_on_timeout=False, sniff_on_start=True)

Note that I am specifying a timeout value of 5 hours (maybe too long for production, but this is for experimental purposes to diagnose what's happening here).

I then make a query like this:
client.search(index=index, body=query, size=0)
with no request_timeout setting (which should inherit the timeout value from the client), or alternately with an explicit request timeout of 5 hours:
client.search(index=index, body=query, size=0, request_timeout=60 * 60 * 5)

In either case, the query fails after ~45 seconds with a timeout exception:
ConnectionTimeout: ConnectionTimeout caused by - ReadTimeoutError(HTTPConnectionPool(host=u'10.110.182.171', port=9200): Read timed out. (read timeout=18000))

Note that the timeout value I specified is reflected in the error message.

If I've said the timeout should be 18000 seconds, why is it giving up after 45? How do I get my queries to wait as long as needed?

This is on Python 2.7.

@alexk307
Copy link
Contributor

alexk307 commented Feb 5, 2020

I believe this fixes the issue: https://github.com/elastic/elasticsearch-py/pull/1051/files

By removing the request_timeout parameter from the decorator, we no longer try to escape it which was causing an issue with urllib3. More details: #1049 (comment)

@alexk307 alexk307 self-assigned this Feb 5, 2020
@sethmlarson
Copy link
Contributor

I believe this issue is already resolved, will reopen if this is not the case.

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

No branches or pull requests

3 participants