Skip to content

Comments

Upgrades Elastic search client and urlib3 libraries.#2024

Open
fressi-elastic wants to merge 49 commits intoelastic:masterfrom
fressi-elastic:esclient-upgrade-2
Open

Upgrades Elastic search client and urlib3 libraries.#2024
fressi-elastic wants to merge 49 commits intoelastic:masterfrom
fressi-elastic:esclient-upgrade-2

Conversation

@fressi-elastic
Copy link
Contributor

@fressi-elastic fressi-elastic commented Jan 13, 2026

This PR upgrades the Elasticsearch client libraries and urllib3 to newer major versions, updating from Elasticsearch 8.x to 9.x and urllib3 1.x to 2.x. The changes include API parameter updates, refactoring of header handling logic, and deprecation of certain track dependencies.

Changes:

  • It sets the minimal Elasticsearch server version to 8.0.0 and update documentation.
  • It updates python package requirements:
    • elasticsearch[async] from 8.6.1 to 9.2.1
    • elastic-transport from 8.4.1 to 9.2.1
    • urllib3 from 1.26.19 to 2.6.3
    • docker from 6.0.0 to 7.1.0 (due to incompatibility with newer urllib3 releases)
  • It renames maxsize parameter to connections_per_node in client initialization to match the new API
  • It removes most of the logic that diverged with the official Elasticsearch client implementation.
  • It allows to specify compatibility mode (8, 9, etc.) in the perform_request method.
  • It refactors header handling logic into reusable functions and improved MIME type compatibility handling
  • It replaces obsolete docker-compose command with docker compose to avoid conflicts with new urlib3 version.
  • It fixes it/docker_dev_image_test.py and update elasticsearch server to version 9.2.4.
  • It update unit tests accordly.

This PR replaces the now obsolete #2003 and it requires PR elastic/rally-tracks#1000

@fressi-elastic fressi-elastic force-pushed the esclient-upgrade-2 branch 3 times, most recently from ee26164 to 1e8aeeb Compare January 13, 2026 17:47
Copy link

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR upgrades the Elasticsearch client libraries and urllib3 to newer major versions, updating from Elasticsearch 8.x to 9.x and urllib3 1.x to 2.x. The changes include API parameter updates, refactoring of header handling logic, and deprecation of certain track dependencies.

Changes:

  • Updated elasticsearch[async] from 8.6.1 to 9.2.1, elastic-transport from 8.4.1 to 9.2.1, and urllib3 from 1.26.19 to 2.6.3
  • Renamed maxsize parameter to connections_per_node in client initialization to match the new API
  • Refactored header handling logic into reusable functions and improved MIME type compatibility handling

Reviewed changes

Copilot reviewed 11 out of 12 changed files in this pull request and generated 1 comment.

Show a summary per file
File Description
pyproject.toml Updated dependency versions for elasticsearch, elastic-transport, urllib3, and pip
esrally/client/factory.py Changed maxsize to connections_per_node parameter
tests/client/factory_test.py Updated test to use connections_per_node parameter
esrally/client/common.py Refactored header combining and MIME type compatibility logic into dedicated functions
esrally/client/synchronous.py Updated to use new header handling functions and added endpoint_id/path_parts parameters
esrally/client/asynchronous.py Updated RallyAsyncElasticsearch signature and header handling to use new functions
esrally/track/loader.py Added deprecation handling for elasticsearch and elastic-transport dependencies in tracks
esrally/utils/versions.py Added type hints to is_version_identifier function
it/init.py Updated test distributions to include 9.2.4 and removed 6.8.0/ARM logic
tests/client/common_test.py Removed test file (likely obsolete after refactoring)
tests/driver/runner_test.py Added typing import and @typing.no_type_check decorator to test

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@fressi-elastic fressi-elastic changed the title Upgrade Elastic search client libraries and urlib3. It upgrades Elastic search client and urlib3 libraries. Jan 20, 2026
Copy link

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 20 out of 21 changed files in this pull request and generated 2 comments.


💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

fressi-elastic and others added 4 commits January 20, 2026 04:47
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
@gbanasiak gbanasiak dismissed their stale review January 30, 2026 11:04

Concerns lifted after internal discussion.

@fressi-elastic
Copy link
Contributor Author

@gbanasiak I followed up the suggestion received during past code review interactions and I moved the logic out of _perform_request method. This highly reduces the code required to implement perform_request methods. I also added a table in the documentation (assuming this change will be introduced along development of version 2.14.0, and that we will create release 2.13.0 just before merging this change.

Copy link
Contributor

@gbanasiak gbanasiak left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Many thanks for simplifications and getting rid of the product checker code! Comments after a more thorough pass below.

Comment on lines 36 to 43
if body is not None:
# It ensures content-type and accept headers are initialized.
mimetype = "application/json"
if path is not None and path.endswith("/_bulk"):
# Server version 9 is picky about this. This should improve compatibility.
mimetype = "application/x-ndjson"
for header in ("content-type", "accept"):
headers.setdefault(header, mimetype)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This seems weird. Why is this required? Is there anything similar in Elasticsearch Python client code? If 9.x version of the client can talk to 9.x version of the server by default, why do we need any extra modifications, e.g. for _bulk?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Older versions of server where assuming JSON type has to be assumed if not specified when the body was clearly a Json. Newer versions are getting more strict, so we have to provide the headers which the track is not providing to allow posting jsons or bulk objects to the server. Version 9 is more picky than version 8.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Rally already had this bofore my change for the reason I explained here.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

BulkIndex runner calls Python client's bulk() which sets the right headers, so the above code seems redundant. Does this address a specific failure? In which test, track, operation?

fressi-elastic and others added 3 commits February 4, 2026 14:34
- Update common_test.py for get_compatibility_mode and ensure_mimetype_headers API
- Update synchronous_test.py and asynchronous_test.py with perform_request tests
- Use monkeypatch and create_autospec; fix type hints and assertions
- Client fixes for mypy/pylint

Co-authored-by: Cursor <cursoragent@cursor.com>
@fressi-elastic fressi-elastic force-pushed the esclient-upgrade-2 branch 2 times, most recently from 32d3650 to 92aaaf9 Compare February 4, 2026 14:08
@gbanasiak
Copy link
Contributor

@fressi-elastic I've worked on style and content of EOL policy, see cdc94e9.

@fressi-elastic fressi-elastic changed the title It upgrades Elastic search client and urlib3 libraries. Upgrades Elastic search client and urlib3 libraries. Feb 10, 2026
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 this pull request may close these issues.

4 participants