elastic / elasticsearch

Free and Open Source, Distributed, RESTful Search Engine
https://www.elastic.co/products/elasticsearch
Other
1.04k stars 24.82k forks source link

[DOCS] Document Content-Type response header breaking change in 8.0 #114669

Open ppf2 opened 3 weeks ago

ppf2 commented 3 weeks ago

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 (https://github.com/elastic/elasticsearch/pull/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

elasticsearchmachine commented 3 weeks ago

Pinging @elastic/es-docs (Team:Docs)