-
Notifications
You must be signed in to change notification settings - Fork 25.6k
Description
Elasticsearch Version
8.0+
Installed Plugins
No response
Java Version
bundled
OS Version
N/A
Problem Description
Some applications like PowerShell's Invoke-RestMethod count on charset information to display data correctly. An undocumented breaking change in 8.0 may cause applications to show non-ASCII characters incorrectly:
From version 8.0.0, Elasticsearch does not send the Content-Type
response header as application/json;charset=utf-8
but simply application/json
. According to RFC 8259, sending the charset information is not required when transferring JSON data, as UTF is the default encoding.
The workaround is for clients to include Accept: application/json; charset=UTF-8
header in requests.
We believe this came as a side effect of content-type parsing refactoring needed for the REST API compatibility added in 8.0 (#61427).
This is a request to confirm the above finding and add the change to our breaking changes documentation. Thx!
Steps to Reproduce
version 8:
curl -XGET "https://xxx.europe-west2.gcp.elastic-cloud.com" -u user -v -H 'Accept: application/json;charset=utf-8'
We get in the response: < content-type: application/json;charset=utf-8
curl -XGET "https://xxx.europe-west2.gcp.elastic-cloud.com" -u user -v
We get in the response: < content-type: application/json
version 7:
curl -XGET "https://xxx.europe-west2.gcp.elastic-cloud.com" -u user -v
We get in the response: < content-type: application/json; charset=UTF-8
Logs (if relevant)
No response