In the field capabilities API, re-add support for fields in the request body (#88972)

We previously removed support for `fields` in the request body, to ensure there
was only one way to specify the parameter. We've now decided to undo the
change, since it was disruptive and the request body is actually the best place to
pass variable-length data like `fields`.

This PR restores support for `fields` in the request body. It throws an error
if the parameter is specified both in the URL and the body.

Closes #86875
This commit is contained in:
likzn 2022-08-05 01:44:50 +08:00 committed by GitHub
parent b81f4187ab
commit f28f4545b2
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
6 changed files with 109 additions and 6 deletions

View file

@ -121,7 +121,6 @@ setup:
---
"Get simple field caps":
- do:
field_caps:
index: 'test1,test2,test3'
@ -162,6 +161,21 @@ setup:
- match: {fields.geo.keyword.indices: ["test3"]}
- is_false: fields.geo.keyword.non_searchable_indices
- is_false: fields.geo.keyword.on_aggregatable_indices
---
"Get field caps with fields in body":
- skip:
version: " - 8.4.99"
reason: re-added support for fields in the request body in 8.5
- do:
field_caps:
index: 'test1,test2,test3'
body:
fields: [text]
- match: {fields.text.text.searchable: true}
- match: {fields.text.text.aggregatable: false}
- is_false: fields.keyword
---
"Get date_nanos field caps":