Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

set value required in constant_keyword field type #419

Merged
merged 2 commits into from
Jul 17, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -82,6 +82,7 @@ Inspired from [Keep a Changelog](https://keepachangelog.com/en/1.0.0/)
- Fixed query DSL `match` that supports a field name and value ([#405](https://github.com/opensearch-project/opensearch-api-specification/pull/405))
- Fixed `/_mapping` with `index` in query ([#385](https://github.com/opensearch-project/opensearch-api-specification/pull/385))
- Fixed duplicate `/_nodes/{node_id}` path ([#416](https://github.com/opensearch-project/opensearch-api-specification/pull/416))
- Fixed required value for `constant_keyword` field type ([#419](https://github.com/opensearch-project/opensearch-api-specification/pull/419))

### Security

Expand Down
3 changes: 2 additions & 1 deletion spec/schemas/_common.mapping.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -789,13 +789,14 @@ components:
- type: object
properties:
value:
type: object
type: string
kkewwei marked this conversation as resolved.
Show resolved Hide resolved
type:
type: string
enum:
- constant_keyword
required:
- type
- value
FieldAliasProperty:
allOf:
- $ref: '#/components/schemas/PropertyBase'
Expand Down
31 changes: 31 additions & 0 deletions tests/mapping/constant_keyword.yaml
Original file line number Diff line number Diff line change
@@ -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
Loading