Skip to content

Commit

Permalink
Fixed Metadata schema. (#399)
Browse files Browse the repository at this point in the history
Signed-off-by: dblock <dblock@amazon.com>
  • Loading branch information
dblock authored Jul 11, 2024
1 parent 39b8265 commit fd96e3e
Show file tree
Hide file tree
Showing 4 changed files with 191 additions and 2 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -69,6 +69,7 @@ Inspired from [Keep a Changelog](https://keepachangelog.com/en/1.0.0/)
- 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 `/{index}/_dangling` that can return `nodes` and `cluster_name` ([#391](https://github.com/opensearch-project/opensearch-api-specification/pull/391))
- Fixed `Metadata` schema ([#399](https://github.com/opensearch-project/opensearch-api-specification/pull/399))

### Security

Expand Down
3 changes: 1 addition & 2 deletions spec/schemas/_common.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -39,8 +39,7 @@ components:
type: string
Metadata:
type: object
additionalProperties:
type: object
additionalProperties: true
GeoBounds:
description: |-
A geo bounding box. It can be represented in various ways:
Expand Down
111 changes: 111 additions & 0 deletions tests/indices/component_template.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,111 @@
$schema: ../../json_schemas/test_story.schema.yaml

description: Test component templates.
epilogues:
- path: /logs-2020-01-01
method: DELETE
status: [200, 404]
- path: /_index_template/daily_logs
method: DELETE
status: [200, 404]
- path: /_component_template/component_template1
method: DELETE
status: [200, 404]
- path: /_component_template/component_template2
method: DELETE
status: [200, 404]
chapters:
- synopsis: Create a component template 1.
path: /_component_template/{name}
method: POST
parameters:
name: component_template_1
request_body:
payload:
template:
mappings:
properties:
'@timestamp':
type: date
response:
status: 200
- synopsis: Get component template 1.
path: /_component_template/{name}
method: GET
parameters:
name: component_template_1
response:
status: 200
- synopsis: Create a component template 2.
path: /_component_template/{name}
method: POST
parameters:
name: component_template_2
request_body:
payload:
template:
mappings:
properties:
ip_address:
type: ip
response:
status: 200
- synopsis: Create an index template composed of 2 component templates.
path: /_index_template/{name}
method: POST
parameters:
name: daily_logs
request_body:
payload:
index_patterns:
- "logs*"
template:
aliases:
my_logs: {}
settings:
number_of_shards: 2
number_of_replicas: 2
mappings:
properties:
timestamp:
type: date
format: yyyy-MM-dd HH:mm:ss||yyyy-MM-dd||epoch_millis
value:
type: double
priority: 200
composed_of:
- component_template_1
- component_template_2
version: 3
_meta:
description: Template using component templates.
response:
status: 200
- synopsis: Create an index using the composite template.
path: /{index}
method: PUT
parameters:
index: logs-2020-01-01
response:
status: 200
- synopsis: Get an index using the composite template.
path: /{index}
method: GET
parameters:
index: logs-2020-01-01
response:
status: 200
- synopsis: Delete index template.
path: /_index_template/{name}
method: DELETE
parameters:
name: daily_logs
response:
status: 200
- synopsis: Delete component template 1.
path: /_component_template/{name}
method: DELETE
parameters:
name: component_template_1
response:
status: 200
78 changes: 78 additions & 0 deletions tests/indices/index_template.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,78 @@
$schema: ../../json_schemas/test_story.schema.yaml

description: Test index templates.
epilogues:
- path: /_index_template/daily_logs
method: DELETE
status: [200, 404]
chapters:
- synopsis: Create an index template.
path: /_index_template/{name}
method: POST
parameters:
name: daily_logs
request_body:
payload:
index_patterns:
- "logs*"
priority: 0
template:
settings:
number_of_shards: 2
number_of_replicas: 2
response:
status: 200
- synopsis: Update an index template.
path: /_index_template/{name}
method: PUT
parameters:
name: daily_logs
request_body:
payload:
index_patterns:
- "logs*"
priority: 0
template:
aliases:
my_logs: {}
settings:
number_of_shards: 4
number_of_replicas: 4
mappings:
properties:
timestamp:
type: date
format: yyyy-MM-dd HH:mm:ss||yyyy-MM-dd||epoch_millis
value:
type: double
response:
status: 200
- synopsis: Retrieve all index templates.
path: /_index_template
method: GET
response:
status: 200
- synopsis: Retrieve an index template.
path: /_index_template/{name}
method: GET
parameters:
name: daily_logs
response:
status: 200
payload:
index_templates:
- name: daily_logs
- synopsis: Check that an index template exists.
path: /_index_template/{name}
method: HEAD
parameters:
name: daily_logs
response:
status: 200
- synopsis: Delete an index template.
path: /_index_template/{name}
method: DELETE
parameters:
name: daily_logs
response:
status: 200

0 comments on commit fd96e3e

Please sign in to comment.