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

Fix: GET _mapping with index in query. #385

Merged
merged 1 commit into from
Jul 11, 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 @@ -76,6 +76,7 @@ Inspired from [Keep a Changelog](https://keepachangelog.com/en/1.0.0/)
- Fixed `Metadata` schema ([#399](https://github.com/opensearch-project/opensearch-api-specification/pull/399))
- Fixed `/_data_stream` health status and required fields ([#401](https://github.com/opensearch-project/opensearch-api-specification/pull/401))
- 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))

### Security

Expand Down
13 changes: 13 additions & 0 deletions spec/namespaces/indices.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -418,6 +418,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:
Expand Down Expand Up @@ -1302,6 +1303,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:
Expand Down Expand Up @@ -3828,6 +3830,17 @@ components:
schema:
type: boolean
style: form
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`.
required: true
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I missed this. it should have been false

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yikes

schema:
$ref: '../schemas/_common.yaml#/components/schemas/Indices'
style: simple
indices.get_mapping::query.local:
in: query
name: local
Expand Down
54 changes: 54 additions & 0 deletions tests/_core/mapping.yaml
Original file line number Diff line number Diff line change
@@ -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
Loading