You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
This issue exists on version 9.0.0 of the elasticsearch-py package. It does not exist on version 8.16.0.
It is replicated on python 3.10.12 and python 3.12.3.
In the python shell:
>>> import elasticsearch
>>> es = elasticsearch.Elasticsearch("http://localhost:9200")
>>> es.indices.get_alias(index="*")
Get's the error:
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "/home/aidans/.local/lib/python3.10/site-packages/elasticsearch/_sync/client/utils.py", line 415, in wrapped
return api(*args, **kwargs)
File "/home/aidans/.local/lib/python3.10/site-packages/elasticsearch/_sync/client/indices.py", line 2278, in get_alias
return self.perform_request( # type: ignore[return-value]
File "/home/aidans/.local/lib/python3.10/site-packages/elasticsearch/_sync/client/_base.py", line 422, in perform_request
return self._client.perform_request(
File "/home/aidans/.local/lib/python3.10/site-packages/elasticsearch/_sync/client/_base.py", line 271, in perform_request
response = self._perform_request(
File "/home/aidans/.local/lib/python3.10/site-packages/elasticsearch/_sync/client/_base.py", line 351, in _perform_request
raise HTTP_EXCEPTIONS.get(meta.status, ApiError)(
elasticsearch.BadRequestError: BadRequestError(400, 'media_type_header_exception', 'Invalid media-type value on headers [Content-Type, Accept]')
My local elastic is configured in docker and reachable with curl. The docker image is: docker.elastic.co/elasticsearch/elasticsearch:8.14.1
The only environment variables I configure the instance with are:
Versions 9.x of the elasticsearch client are not compatible with 8.x servers. You need to downgrade your client to 8.18.0, or else upgrade your server to 9.0.0.
In general, I would recommend that you use the same major and minor versions in your server and client, to ensure maximum compatibility. So in this case if you must stay on the 8.14.1 server you should use the latest 8.14.x version of the Python client package.
As of 9.0.1, elasticsearch-py will return a much clearer error:
elasticsearch.BadRequestError: BadRequestError(400, 'media_type_header_exception', 'Invalid media-type value on headers [Accept, Content-Type]', Accept version must be either version 8 or 7, but found 9. Accept=application/vnd.elasticsearch+json; compatible-with=9)
We may improve it in the future.
Additionally, we updated the release notes to clarify that the Elasticsearch server should be upgraded before the client.
This issue exists on version 9.0.0 of the elasticsearch-py package. It does not exist on version 8.16.0.
It is replicated on python 3.10.12 and python 3.12.3.
In the python shell:
Get's the error:
My local elastic is configured in docker and reachable with curl. The docker image is: docker.elastic.co/elasticsearch/elasticsearch:8.14.1
The only environment variables I configure the instance with are:
The text was updated successfully, but these errors were encountered: