From 6a759f1d87c906b1f90a4338ebaab4b4950bdf9c Mon Sep 17 00:00:00 2001 From: dblock Date: Mon, 8 Jul 2024 13:22:37 -0400 Subject: [PATCH] Fix: GET _mapping with index in query. Signed-off-by: dblock --- CHANGELOG.md | 1 + spec/namespaces/indices.yaml | 11 ++++++++ tests/_core/mapping.yaml | 54 ++++++++++++++++++++++++++++++++++++ 3 files changed, 66 insertions(+) create mode 100644 tests/_core/mapping.yaml diff --git a/CHANGELOG.md b/CHANGELOG.md index 55248104d..406edb83b 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -63,6 +63,7 @@ Inspired from [Keep a Changelog](https://keepachangelog.com/en/1.0.0/) - Fixed optional field in `/_nodes` ([#365](https://github.com/opensearch-project/opensearch-api-specification/pull/365)) - Fixed `/{index}/_open` can return a `task` ([#376](https://github.com/opensearch-project/opensearch-api-specification/pull/376)) - Fixed `_source` in `bulk` responses ([#375](https://github.com/opensearch-project/opensearch-api-specification/pull/375)) +- Fixed `/_mapping` with `index` in query ([#385](https://github.com/opensearch-project/opensearch-api-specification/pull/385)) ### Security diff --git a/spec/namespaces/indices.yaml b/spec/namespaces/indices.yaml index 2bda325dc..b68c477a8 100644 --- a/spec/namespaces/indices.yaml +++ b/spec/namespaces/indices.yaml @@ -417,6 +417,7 @@ paths: - $ref: '#/components/parameters/indices.get_mapping::query.cluster_manager_timeout' - $ref: '#/components/parameters/indices.get_mapping::query.expand_wildcards' - $ref: '#/components/parameters/indices.get_mapping::query.ignore_unavailable' + - $ref: '#/components/parameters/indices.get_mapping::query.index' - $ref: '#/components/parameters/indices.get_mapping::query.local' - $ref: '#/components/parameters/indices.get_mapping::query.master_timeout' responses: @@ -3780,6 +3781,16 @@ components: schema: $ref: '../schemas/_common.yaml#/components/schemas/Indices' style: simple + indices.get_mapping::query.index: + in: query + name: index + description: |- + Comma-separated list of data streams, indices, and aliases used to limit + the request. Supports wildcards (`*`). To target all data streams and + indices, omit this parameter or use `*` or `_all`. + schema: + type: string + style: form indices.get_mapping::query.allow_no_indices: in: query name: allow_no_indices diff --git a/tests/_core/mapping.yaml b/tests/_core/mapping.yaml new file mode 100644 index 000000000..05f854326 --- /dev/null +++ b/tests/_core/mapping.yaml @@ -0,0 +1,54 @@ +$schema: ../../json_schemas/test_story.schema.yaml + +description: Test mappings endpoints. +prologues: + - path: /{index} + method: PUT + parameters: + index: movies + request_body: + payload: + mappings: + properties: + director: + type: text + year: + type: integer + location: + type: ip + ignore_malformed: true +epilogues: + - path: /movies + method: DELETE + status: [200, 404] +chapters: + - synopsis: Get mappings for an index (index in query). + path: /_mapping + method: GET + parameters: + index: movies + response: + status: 200 + payload: + movies: + mappings: + properties: + director: + type: text + year: + type: integer + - synopsis: Get mappings for an index (index in path). + path: /{index}/_mapping + method: GET + parameters: + index: movies + response: + status: 200 + payload: + movies: + mappings: + properties: + director: + type: text + year: + type: integer