From 343b28ae2c23507bfb29f7777fa6d9d79d2c8cbd Mon Sep 17 00:00:00 2001 From: gaobinlong Date: Wed, 17 Jul 2024 17:29:25 +0800 Subject: [PATCH 1/2] Add parameter for create or update alias API Signed-off-by: gaobinlong --- CHANGELOG.md | 1 + spec/namespaces/indices.yaml | 5 +++ tests/indices/create_or_update_alias.yaml | 42 +++++++++++++++++++++++ 3 files changed, 48 insertions(+) create mode 100644 tests/indices/create_or_update_alias.yaml diff --git a/CHANGELOG.md b/CHANGELOG.md index 004de5615..e479b6bfd 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -46,6 +46,7 @@ Inspired from [Keep a Changelog](https://keepachangelog.com/en/1.0.0/) - Added missing fields to `/_nodes/stats` ([#415](https://github.com/opensearch-project/opensearch-api-specification/pull/415)) - Added missing metrics options to `/_nodes/stats` ([#422](https://github.com/opensearch-project/opensearch-api-specification/pull/422)) - Added tests against OpenSearch 1.3 ([#424](https://github.com/opensearch-project/opensearch-api-specification/pull/424)) +- Add `is_hidden` parameter for create or update alias API ### Changed diff --git a/spec/namespaces/indices.yaml b/spec/namespaces/indices.yaml index dc113533b..d26a28e08 100644 --- a/spec/namespaces/indices.yaml +++ b/spec/namespaces/indices.yaml @@ -1860,6 +1860,11 @@ components: $ref: '../schemas/_common.yaml#/components/schemas/Routing' search_routing: $ref: '../schemas/_common.yaml#/components/schemas/Routing' + is_hidden: + x-version-added: '2.16' + description: |- + If `true`, the alias will be hidden, defaults to `false`. + type: boolean description: The settings for the alias, such as `routing` or `filter` indices.put_index_template: content: diff --git a/tests/indices/create_or_update_alias.yaml b/tests/indices/create_or_update_alias.yaml new file mode 100644 index 000000000..30e556715 --- /dev/null +++ b/tests/indices/create_or_update_alias.yaml @@ -0,0 +1,42 @@ +$schema: ../../json_schemas/test_story.schema.yaml + +description: Test create or update alias endpoints. +epilogues: + - path: /games + method: DELETE + status: [200, 404] +prologues: + - path: /{index} + method: PUT + parameters: + index: games +chapters: + - synopsis: Create an alias. + path: /{index}/_alias/{name} + method: PUT + parameters: + index: games + name: jeux + - synopsis: Create an alias with custom routing. + path: /{index}/_alias/{name} + method: PUT + parameters: + index: games + name: jeux + request_body: + payload: + index_routing: test1 + search_routing: test2 + - synopsis: Create an alias with custom settings. + path: /{index}/_alias/{name} + method: PUT + parameters: + index: games + name: jeux + request_body: + payload: + routing: test + is_write_index: true + is_hidden: true + filter: + match_all: {} From 3baf3e454ea8098ad355aed137b429e9208885af Mon Sep 17 00:00:00 2001 From: gaobinlong Date: Thu, 18 Jul 2024 11:43:30 +0800 Subject: [PATCH 2/2] Optimize changelog and test case Signed-off-by: gaobinlong --- CHANGELOG.md | 2 +- spec/namespaces/indices.yaml | 3 +- tests/indices/aliases.yaml | 30 ++++++++++++++++ tests/indices/create_or_update_alias.yaml | 42 ----------------------- 4 files changed, 33 insertions(+), 44 deletions(-) delete mode 100644 tests/indices/create_or_update_alias.yaml diff --git a/CHANGELOG.md b/CHANGELOG.md index e479b6bfd..fc2369d39 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -46,7 +46,7 @@ Inspired from [Keep a Changelog](https://keepachangelog.com/en/1.0.0/) - Added missing fields to `/_nodes/stats` ([#415](https://github.com/opensearch-project/opensearch-api-specification/pull/415)) - Added missing metrics options to `/_nodes/stats` ([#422](https://github.com/opensearch-project/opensearch-api-specification/pull/422)) - Added tests against OpenSearch 1.3 ([#424](https://github.com/opensearch-project/opensearch-api-specification/pull/424)) -- Add `is_hidden` parameter for create or update alias API +- Added `is_hidden` to `/{index}/_alias/{name}` and `/{index}/_aliases/{name}` ([#429](https://github.com/opensearch-project/opensearch-api-specification/pull/429)) ### Changed diff --git a/spec/namespaces/indices.yaml b/spec/namespaces/indices.yaml index d26a28e08..99895bbea 100644 --- a/spec/namespaces/indices.yaml +++ b/spec/namespaces/indices.yaml @@ -1863,8 +1863,9 @@ components: is_hidden: x-version-added: '2.16' description: |- - If `true`, the alias will be hidden, defaults to `false`. + If `true`, the alias will be hidden`. type: boolean + default: false description: The settings for the alias, such as `routing` or `filter` indices.put_index_template: content: diff --git a/tests/indices/aliases.yaml b/tests/indices/aliases.yaml index f9d7dc485..1e28a2638 100644 --- a/tests/indices/aliases.yaml +++ b/tests/indices/aliases.yaml @@ -73,3 +73,33 @@ chapters: parameters: index: games name: plays2 + - synopsis: Create an alias by Create or Update alias endpoint. + path: /{index}/_alias/{name} + method: PUT + parameters: + index: games + name: jeux + - synopsis: Create an alias with custom settings by Create or Update alias endpoint. + path: /{index}/_alias/{name} + method: PUT + parameters: + index: games + name: jeux + request_body: + payload: + index_routing: test1 + search_routing: test2 + routing: test + is_write_index: true + filter: + match_all: {} + - synopsis: Create an alias with is_hidden by Create or Update alias endpoint. + version: '>= 2.16' + path: /{index}/_alias/{name} + method: PUT + parameters: + index: games + name: jeux + request_body: + payload: + is_hidden: true diff --git a/tests/indices/create_or_update_alias.yaml b/tests/indices/create_or_update_alias.yaml deleted file mode 100644 index 30e556715..000000000 --- a/tests/indices/create_or_update_alias.yaml +++ /dev/null @@ -1,42 +0,0 @@ -$schema: ../../json_schemas/test_story.schema.yaml - -description: Test create or update alias endpoints. -epilogues: - - path: /games - method: DELETE - status: [200, 404] -prologues: - - path: /{index} - method: PUT - parameters: - index: games -chapters: - - synopsis: Create an alias. - path: /{index}/_alias/{name} - method: PUT - parameters: - index: games - name: jeux - - synopsis: Create an alias with custom routing. - path: /{index}/_alias/{name} - method: PUT - parameters: - index: games - name: jeux - request_body: - payload: - index_routing: test1 - search_routing: test2 - - synopsis: Create an alias with custom settings. - path: /{index}/_alias/{name} - method: PUT - parameters: - index: games - name: jeux - request_body: - payload: - routing: test - is_write_index: true - is_hidden: true - filter: - match_all: {}