Skip to content

Commit

Permalink
Add strict_allow_templates option for the dynamic mapping parameter (#…
Browse files Browse the repository at this point in the history
…408)

* Add strict_allow_templates option for the dynamic mapping parameter

Signed-off-by: gaobinlong <[email protected]>

* Add change log

Signed-off-by: gaobinlong <[email protected]>

* Add tests

Signed-off-by: gaobinlong <[email protected]>

* Fix format issue

Signed-off-by: gaobinlong <[email protected]>

* Update image for 2.16.0 version

Signed-off-by: gaobinlong <[email protected]>

---------

Signed-off-by: gaobinlong <[email protected]>
  • Loading branch information
gaobinlong authored Jul 23, 2024
1 parent 34ff292 commit 9d2766f
Show file tree
Hide file tree
Showing 4 changed files with 58 additions and 4 deletions.
4 changes: 2 additions & 2 deletions .github/workflows/test-spec.yml
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ jobs:
- {version: 1.3.17, admin_password: admin}
- {version: 2.0.0, admin_password: admin}
- {version: 2.15.0}
- {version: 2.16.0, hub: opensearchstaging, ref: '@sha256:aa99ce3e2c9c94cd934cf98bab753a9920bfdbbb74bdc932d1b443d31c18d6b2'}
- {version: 2.16.0, hub: opensearchstaging, ref: '@sha256:50fbfe3b95c41e92a113ada3e80513ba4524dfc8a25dc6aaeff2bbe1e1145d5f'}

name: test-opensearch-spec (version=${{ matrix.entry.version }}, hub=${{ matrix.entry.hub || 'opensearchproject' }})
runs-on: ubuntu-latest
Expand Down Expand Up @@ -111,4 +111,4 @@ jobs:
uses: actions/upload-artifact@v4
with:
name: pr-comment
path: pr-comment.json
path: pr-comment.json
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,7 @@ Inspired from [Keep a Changelog](https://keepachangelog.com/en/1.0.0/)
- Added `concurrent_query_*` and `search_idle_reactivate_count_total` fields to `SearchStats` ([#395](https://github.com/opensearch-project/opensearch-api-specification/pull/395))
- Added `remote_store` to `TranslogStats` ([#395](https://github.com/opensearch-project/opensearch-api-specification/pull/395))
- Added `file` to `/_cache/clear` and `/{index}/_cache/clear` ([#396](https://github.com/opensearch-project/opensearch-api-specification/pull/396))
- Add `strict_allow_templates` option for the dynamic mapping parameter ([#408](https://github.com/opensearch-project/opensearch-api-specification/pull/408))
- Added a workflow to run tests against the next version of OpenSearch ([#409](https://github.com/opensearch-project/opensearch-api-specification/pull/409))
- Added support for skipping tests using semver range ([#410](https://github.com/opensearch-project/opensearch-api-specification/pull/410))
- Added `cluster_manager_timeout` to `HEAD /{index}` ([#421](https://github.com/opensearch-project/opensearch-api-specification/pull/421))
Expand Down
2 changes: 1 addition & 1 deletion spec/schemas/_common.mapping.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -136,8 +136,8 @@ components:
type: string
enum:
- 'false'
- runtime
- strict
- strict_allow_templates
- 'true'
DynamicTemplate:
type: object
Expand Down
55 changes: 54 additions & 1 deletion tests/indices/mapping.yml
Original file line number Diff line number Diff line change
Expand Up @@ -70,6 +70,7 @@ chapters:
write_index_only: true
request_body:
payload:
dynamic: 'true'
properties:
producer:
type: text
Expand All @@ -92,4 +93,56 @@ chapters:
response:
status: 200
payload:
acknowledged: true
acknowledged: true
- synopsis: Update mapping for an index with setting dynamic to false.
path: /{index}/_mapping
method: PUT
parameters:
index: movies
allow_no_indices: true
expand_wildcards: none
ignore_unavailable: true
timeout: 10s
write_index_only: true
request_body:
payload:
dynamic: 'false'
response:
status: 200
payload:
acknowledged: true
- synopsis: Update mapping for an index with setting dynamic to strict.
path: /{index}/_mapping
method: PUT
parameters:
index: movies
allow_no_indices: true
expand_wildcards: none
ignore_unavailable: true
timeout: 10s
write_index_only: true
request_body:
payload:
dynamic: strict
response:
status: 200
payload:
acknowledged: true
- synopsis: Update mapping for an index with setting dynamic to strict_allow_templates.
version: '>= 2.16'
path: /{index}/_mapping
method: PUT
parameters:
index: movies
allow_no_indices: true
expand_wildcards: none
ignore_unavailable: true
timeout: 10s
write_index_only: true
request_body:
payload:
dynamic: strict_allow_templates
response:
status: 200
payload:
acknowledged: true

0 comments on commit 9d2766f

Please sign in to comment.