Jay Modi 7520a107be Optionally require a valid content type for all rest requests with content (#22691)
This change adds a strict mode for xcontent parsing on the rest layer. The strict mode will be off by default for 5.x and in a separate commit will be enabled by default for 6.0. The strict mode, which can be enabled by setting `http.content_type.required: true` in 5.x, will require that all incoming rest requests have a valid and supported content type header before the request is dispatched. In the non-strict mode, the Content-Type header will be inspected and if it is not present or not valid, we will continue with auto detection of content like we have done previously.

The content type header is parsed to the matching XContentType value with the only exception being for plain text requests. This value is then passed on with the content bytes so that we can reduce the number of places where we need to auto-detect the content type.

As part of this, many transport requests and builders were updated to provide methods that
accepted the XContentType along with the bytes and the methods that would rely on auto-detection have been deprecated.

In the non-strict mode, deprecation warnings are issued whenever a request with body doesn't provide the Content-Type header.

See #19388
2017-02-02 14:07:13 -05:00

40 lines
1.6 KiB
Plaintext

[[breaking_60_rest_changes]]
=== REST changes
==== Unquoted JSON
In previous versions of Elasticsearch, JSON documents were allowed to contain unquoted field names.
This feature was removed in the 5.x series, but a backwards-compatibility layer was added via the
system property `elasticsearch.json.allow_unquoted_field_names`. This backwards-compatibility layer
has been removed in Elasticsearch 6.0.0.
==== Duplicate Keys in JSON, CBOR, Yaml and Smile
In previous versions of Elasticsearch, documents were allowed to contain duplicate keys. Elasticsearch 6.0.0
enforces that all keys are unique. This applies to all content types: JSON, CBOR, Yaml and Smile.
==== Content-Type Auto-detection
In previous versions of Elasticsearch, having a proper Content-Type for the data in a request was not enforced.
Elasticsearch 6.0.0 enforces that all requests with a body must have a supported Content-Type and this type will
be used when parsing the data.
==== Boolean API parameters
All REST APIs parameters (both request parameters and JSON body) support providing boolean "false" as the
value `false` and boolean "true" as the value `true`. All other values will raise an error.
==== Analyze API changes
The deprecated request parameters and plain text in request body has been removed. Define parameters in request body.
==== Indices exists API
The `ignore_unavailable` and `allow_no_indices` options are no longer accepted
as they could cause undesired results when their values differed from their
defaults.
=== `timestamp` and `ttl` in index requests
`timestamp` and `ttl` are not accepted anymore as parameters of index/update
requests.