Skip to content

Upgrade Elasticsearch Python client to 9.x and urllib3 2.x#2024

Closed
fressi-elastic wants to merge 64 commits into
elastic:masterfrom
fressi-elastic:esclient-upgrade-2
Closed

Upgrade Elasticsearch Python client to 9.x and urllib3 2.x#2024
fressi-elastic wants to merge 64 commits into
elastic:masterfrom
fressi-elastic:esclient-upgrade-2

Conversation

@fressi-elastic
Copy link
Copy Markdown
Contributor

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

Summary

Upgrades Rally’s Elasticsearch dependencies to the 9.x Python client stack and urllib3 2.x, updates the sync/async Rally client subclasses to match current transport APIs and stricter Elasticsearch 9 request expectations, and tightens documented Elasticsearch version support for Rally 2.14.0+.

Dependency changes

  • elasticsearch[async] ==9.3.0
  • elastic-transport ==9.2.1
  • urllib3 ==2.6.3

Client factory uses connections_per_node (replacing the old pool maxsize-style parameter) — see esrally/client/factory.py

Behavior and compatibility

Minimum benchmark target is Elasticsearch 8.0.0 esrally/min-es-version.txt; support for 6.8 / 7.x as benchmark clusters is dropped with this release line.

Rally extensions around the official client remain focused on compatibility mode (talking to ES 8 with a 9.x client where appropriate), header handling (including bulk application/x-ndjson where ES 9 is strict), and serverless behavior (e.g. not sending compatible-with where it does not apply).

Legacy _ProductChecker / product-header workaround code paths are removed; client code is aligned with upstream patterns where possible.

Documentation

docs/versions.rst: EOL / support policy for 2.14.0+ (current + previous major) and a Rally ↔ Elasticsearch compatibility matrix.

Other doc updates align examples and migration/add-track guidance with 8.x / 9.x (no OSS-distribution wording that no longer applies).

Testing

Integration tests exercise version.minimum_es_version() (8.0.0) and a 9.x distribution — see it/__init__.py.

Unit tests cover the refactored client helpers and perform_request behavior.

Related work

Track dependency fix for elastic/security (pinned elasticsearch / elastic-transport in tracks) lives in rally-tracks (see linked PR there); Rally does not need a long-term loader workaround for that case.

Closes #2018 (if still accurate when merging).

Release / rollout notes

Intended to land in a 2.14.x Rally line after a 2.13.x release so users still on old clusters have a final supported Rally version (per maintainer discussion on the PR).

Performance A/B vs the old client was not explicitly benchmarked in isolation; rely on CI, integration tests, and optional nightly/staging soak as needed.

@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
Copy Markdown
Contributor

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.

Comment thread esrally/client/common.py Outdated
@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
Copy Markdown
Contributor

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.

Comment thread esrally/track/loader.py Outdated
Comment thread esrally/track/loader.py Outdated
fressi-elastic and others added 4 commits January 20, 2026 04:47
@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
@fressi-elastic
Copy link
Copy Markdown
Contributor Author

This change should fix #2018

@fressi-elastic fressi-elastic changed the title Upgrades Elastic search client and urlib3 libraries. Upgrade Elasticsearch Python client to 9.x and urllib3 2.x Mar 28, 2026
@fressi-elastic fressi-elastic added this to the 2.14.0 milestone Mar 30, 2026
@fressi-elastic fressi-elastic added enhancement Improves the status quo highlight A substantial improvement that is worth mentioning separately in release notes dependencies Pull requests that update a dependency file labels Mar 30, 2026
@fressi-elastic fressi-elastic requested a review from Copilot March 30, 2026 23:16
Copy link
Copy Markdown
Contributor

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 36 out of 37 changed files in this pull request and generated 5 comments.


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

Comment thread release-docker-test.sh Outdated
Comment thread esrally/client/factory.py Outdated
Comment thread docker/docker-compose-tests.yml Outdated
Comment thread tests/client/common_test.py
Comment thread esrally/client/common.py Outdated
fressi-elastic and others added 7 commits March 31, 2026 01:27
Remove obsolete types-urllib3 stubs and require types-requests>=2.31.0.7 so
stubs align with urllib3 2.x inline types. Regenerate uv.lock.

Made-with: Cursor
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Copilot: want was unused when want_error is set; drop want for clarity.
Made-with: Cursor
Replace docker compose --help with docker compose version so integration
test setup still verifies Compose is available without flooding logs with
the full help text.

Made-with: Cursor
@fressi-elastic
Copy link
Copy Markdown
Contributor Author

fressi-elastic commented Apr 2, 2026

@fressi-elastic fressi-elastic deleted the esclient-upgrade-2 branch April 10, 2026 10:01
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

dependencies Pull requests that update a dependency file enhancement Improves the status quo highlight A substantial improvement that is worth mentioning separately in release notes

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Update urllib to something greater than 2.5

5 participants