Skip to content

Commit

Permalink
Fix: correct DataStream fields.
Browse files Browse the repository at this point in the history
Signed-off-by: dblock <[email protected]>
  • Loading branch information
dblock committed Jul 10, 2024
1 parent 046b7d1 commit f7fcb90
Show file tree
Hide file tree
Showing 4 changed files with 72 additions and 6 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,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 `/_data_stream` health status and required fields ([#401](https://github.com/opensearch-project/opensearch-api-specification/pull/401))

### Security

Expand Down
6 changes: 6 additions & 0 deletions spec/schemas/_common.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -749,6 +749,12 @@ components:
- green
- yellow
- red
HealthStatusCapitalized:
type: string
enum:
- GREEN
- YELLOW
- RED
ScheduleTimeOfDay:
description: A time of day, expressed either as `hh:mm`, `noon`, `midnight`, or an hour/minutes structure.
oneOf:
Expand Down
7 changes: 1 addition & 6 deletions spec/schemas/indices._common.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -876,7 +876,7 @@ components:
description: If `true`, the data stream is created and managed by cross-cluster replication and the local cluster can not write into this data stream or change its mappings.
type: boolean
status:
$ref: '_common.yaml#/components/schemas/HealthStatus'
$ref: '_common.yaml#/components/schemas/HealthStatusCapitalized'
system:
description: If `true`, the data stream is created and managed by an OpenSearch stack component and cannot be modified through normal user interaction.
type: boolean
Expand All @@ -886,9 +886,6 @@ components:
$ref: '#/components/schemas/DataStreamTimestampField'
required:
- generation
- hidden
- next_generation_managed_by
- prefer_ilm
- indices
- name
- status
Expand Down Expand Up @@ -917,8 +914,6 @@ components:
required:
- index_name
- index_uuid
- managed_by
- prefer_ilm
DataStreamTimestampField:
type: object
properties:
Expand Down
64 changes: 64 additions & 0 deletions tests/indices/data_stream.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,64 @@
$schema: ../../json_schemas/test_story.schema.yaml

description: Test data streams.
epilogues:
- path: /_data_stream/logs-nginx
method: DELETE
status: [200, 404]
- path: /_index_template/logs-template
method: DELETE
status: [200, 404]
chapters:
- synopsis: Create an index template.
path: /_index_template/{name}
method: PUT
parameters:
name: logs-template-nginx
request_body:
payload:
index_patterns:
- my-data-stream
- logs-*
data_stream:
timestamp_field:
name: request_time
priority: 100
- synopsis: Create a data stream.
path: /_data_stream/{name}
method: PUT
parameters:
name: logs-nginx
- synopsis: Ingest data.
path: /{index}/_doc
method: POST
parameters:
index: logs-nginx
request_body:
payload:
message: login attempt failed
request_time: '2013-03-01T00:00:00'
response:
status: 201
- synopsis: Get a data stream.
path: /_data_stream/{name}
method: GET
parameters:
name: logs-nginx
- synopsis: Get data stream stats.
path: /_data_stream/{name}/_stats
method: GET
parameters:
name: logs-nginx
- synopsis: Manually roll over a data stream.
path: /{alias}/_rollover
method: POST
parameters:
alias: logs-nginx
- synopsis: Get all data streams.
path: /_data_stream
method: GET
- synopsis: Delete a data stream.
path: /_data_stream/{name}
method: DELETE
parameters:
name: logs-nginx

0 comments on commit f7fcb90

Please sign in to comment.