Closed lvaylet closed 2 years ago
The test suite completes successfully after pinning elasticsearch
to version 7.17.1
. The latest 8.x.x
release (8.1.1
at the time of writing) probably introduces a breaking change in how the ElasticSearch client is created and configured.
The release notes do not provide any specific migration instructions. However, the Overview pages of versions 7.17
and 8.1
show clear differences in how the client is created and configured:
>>> from elasticsearch import Elasticsearch
# By default we connect to localhost:9200
>>> es = Elasticsearch()
>>> from elasticsearch import Elasticsearch
# Connect to 'http://localhost:9200'
>>> es = Elasticsearch("http://localhost:9200")
@ocervell Passing the url
entry of the es_config
dictionary to the Elasticsearch client (instead of the whole dictionary) is a simple fix for this bug. However I am not sure about the impact on current deployments.
class ElasticsearchBackend:
def __init__(self, client=None, **es_config):
self.client = client
if self.client is None:
+ self.client = Elasticsearch(es_config['url'])
- self.client = Elasticsearch(**es_config)
The Elasticsearch client documentation states that:
Language clients are forward compatible; meaning that clients support communicating with greater or equal minor versions of Elasticsearch. Elasticsearch language clients are only backwards compatible with default distributions and without guarantees made.
WDYT?
Steps to reproduce (with Python 3.9.12):