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:
timeoutis nowrequest_timeoutrandomize_hostsis nowrandomize_nodes_in_poolhost_info_callbackis nowsniffed_node_callbacksniffer_timeoutis nowmin_delay_between_sniffingsniff_on_connection_failis nowsniff_on_node_failuremaxsizeis nowconnections_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_sslisn't needed, as a scheme is required since elasticsearch-py 8.0 (httporhttps)url_prefixshould 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
knnoption 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.