Improve the timeout implementation for Elasticsearch

Description

Improve the timeout implementation:

  1. Checking whether the timeout was exceeded before sending the HTTP request. If it has been exceeded, and the user doesn't want partial results, there's no point in running the query: we can just fail immediately.

  2. We could set the timeout HTTP query parameter dynamically based on the remaining time, just before the HTTP request is actually sent by the HTTP client.

Environment

None

Assignee

Unassigned

Reporter

Fabio Massimo Ercoli

Labels

None

Suitable for new contributors

Yes, likely

Pull Request

None

Feedback Requested

None

Components

Fix versions

Affects versions

Priority

Minor
Configure