Elasticsearch Python Client breaking changes
Breaking changes can impact your Elastic applications, potentially disrupting normal operations. Before you upgrade, carefully review the Elasticsearch Python Client breaking changes and take the necessary steps to mitigate any issues. To learn how to upgrade, check Upgrade.
Remove deprecated Elasticsearch() options
The timeout
, randomize_hosts
, host_info_callback
, sniffer_timeout
, sniff_on_connection_fail
and maxsize
parameters were deprecated in elasticsearch-py 8.0 and are now removed from Elasticsearch.__init__()
.
For more information, check PR #2840.
Impact
These parameters were removed in favor of more descriptive versions. Using any of these parameters will prevent instantiating the Elasticsearch client.
Action
These parameters can be replaced as follows:
timeout
is nowrequest_timeout
randomize_hosts
is nowrandomize_nodes_in_pool
host_info_callback
is nowsniffed_node_callback
sniffer_timeout
is nowmin_delay_between_sniffing
sniff_on_connection_fail
is nowsniff_on_node_failure
maxsize
is nowconnection_per_node
Remove deprecated url_prefix and use_ssl host keys
When instantiating a new client, hosts
can be specified as a dictionary. The url_prefix
and use_ssl
keys are no longer allowed.
For more information, check PR #2797.
Impact
Using any of these parameters will prevent instantiating the Elasticsearch client.
Action
The parameters can be replaced as follows:
use_ssl
isn't needed, as a scheme is required since elasticsearch-py 8.0 (http
orhttps
)url_prefix
should be replaced withpath_prefix
, which is more descriptive. This functionality allows you to deploy Elasticsearch under a specific path, such ashttp://host:port/path/to/elasticsearch
, instead of the default root path (http://host:port/
)
Remove APIs
Elasticsearch 9 removed the kNN search and Unfreeze index APIs.
Action
- The kNN search API has been replaced by the
knn
option in the search API since Elasticsearch 8.4. - The Unfreeze index API was deprecated in Elasticsearch 7.14 and has been removed in Elasticsearch 9.