diff --git a/CHANGELOG.md b/CHANGELOG.md index d4a709673..7f2fcbdcb 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -52,6 +52,7 @@ Inspired from [Keep a Changelog](https://keepachangelog.com/en/1.0.0/) - Prevented merger tool from printing warnings when used by tester tool [#359](https://github.com/opensearch-project/opensearch-api-specification/pull/359) - Replaced the deprecated fs.rmdirSync with fs.rmSync [#359](https://github.com/opensearch-project/opensearch-api-specification/pull/359) - Tester tool now provides better context for non-2XX responses when --verbose is used [#359](https://github.com/opensearch-project/opensearch-api-specification/pull/359) +- Set value required in constant_keyword field type [#419](https://github.com/opensearch-project/opensearch-api-specification/pull/419) ### Deprecated diff --git a/spec/schemas/_common.mapping.yaml b/spec/schemas/_common.mapping.yaml index 18ef5472f..6c4645abe 100644 --- a/spec/schemas/_common.mapping.yaml +++ b/spec/schemas/_common.mapping.yaml @@ -789,13 +789,14 @@ components: - type: object properties: value: - type: object + type: string type: type: string enum: - constant_keyword required: - type + - value FieldAliasProperty: allOf: - $ref: '#/components/schemas/PropertyBase' diff --git a/tests/mapping/constant_keyword.yaml b/tests/mapping/constant_keyword.yaml new file mode 100644 index 000000000..0d209edc5 --- /dev/null +++ b/tests/mapping/constant_keyword.yaml @@ -0,0 +1,31 @@ +$schema: ../../json_schemas/test_story.schema.yaml + +description: Test constant_keyword field type and retrieving a doc. +version: '>= 2.14' +prologues: + - path: /movies + method: PUT + request_body: + payload: + mappings: + properties: + genre: + type: constant_keyword + value: Romantic comedy + +epilogues: + - path: /movies + method: DELETE + status: [200, 404] +chapters: + - synopsis: Create a document. + path: /{index}/_doc + method: POST + parameters: + index: movies + request_body: + payload: + genre: Romantic comedy + year: 1991 + response: + status: 201