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

Test and fix remaining /_ingest paths. #689

Merged
merged 3 commits into from
Nov 24, 2024
Merged
Show file tree
Hide file tree
Changes from 2 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
2 changes: 2 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ Inspired from [Keep a Changelog](https://keepachangelog.com/en/1.0.0/)
- Added `PhoneAnalyzer` from `analysis-phonenumber` plugin ([#609](https://github.com/opensearch-project/opensearch-api-specification/pull/609))
- Added `/_list/indices` & `/_list/shards` api specs ([#613](https://github.com/opensearch-project/opensearch-api-specification/pull/613))
- Added `GET` and `HEAD /{index}/_source/{id}` returning `404` ([#673](https://github.com/opensearch-project/opensearch-api-specification/pull/673))
- Added `s` to `/_ingest/processor/grok` ([#689](https://github.com/opensearch-project/opensearch-api-specification/pull/689))

### Removed
- Removed unsupported `_common.mapping:SourceField`'s `mode` field and associated `_common.mapping:SourceFieldMode` enum ([#652](https://github.com/opensearch-project/opensearch-api-specification/pull/652))
Expand All @@ -38,6 +39,7 @@ Inspired from [Keep a Changelog](https://keepachangelog.com/en/1.0.0/)
- Fixed `value` type in `ExplanationDetail` and added `_type` to `explain@200` ([#685](https://github.com/opensearch-project/opensearch-api-specification/pull/685))
- Fixed index settings types ([#684](https://github.com/opensearch-project/opensearch-api-specification/pull/684))
- Fixed `POST` and `DELETE /_dangling/{index_uuid}` returning `202` ([#686](https://github.com/opensearch-project/opensearch-api-specification/pull/686))
- Fixed `/_ingest/pipeline/{id}/_simulate` response `docs/_source` field schema ([#689](https://github.com/opensearch-project/opensearch-api-specification/pull/689))

### Changed
- Changed `tasks._common:TaskInfo` and `tasks._common:TaskGroup` to be composed of a `tasks._common:TaskInfoBase` ([#683](https://github.com/opensearch-project/opensearch-api-specification/pull/683))
Expand Down
10 changes: 9 additions & 1 deletion spec/namespaces/ingest.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -133,7 +133,8 @@ paths:
description: Returns a list of the built-in patterns.
externalDocs:
url: https://opensearch.org/docs/latest
parameters: []
parameters:
- $ref: '#/components/parameters/ingest.processor_grok::query.s'
responses:
'200':
$ref: '#/components/responses/ingest.processor_grok@200'
Expand Down Expand Up @@ -340,3 +341,10 @@ components:
type: boolean
default: false
style: form
ingest.processor_grok::query.s:
name: s
in: query
description: Sort returned patterns by key name.
schema:
type: boolean
default: false
3 changes: 1 addition & 2 deletions spec/schemas/ingest.simulate.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -48,8 +48,7 @@ components:
_source:
description: JSON body for the document.
type: object
additionalProperties:
type: object
additionalProperties: true
_version:
$ref: '_common.yaml#/components/schemas/StringifiedVersionNumber'
_version_type:
Expand Down
65 changes: 65 additions & 0 deletions tests/default/ingest/pipeline.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,65 @@
$schema: ../../../json_schemas/test_story.schema.yaml

description: Test the creation of an ingest pipeline.
epilogues:
- path: /_ingest/pipeline/books_pipeline
method: DELETE
status: [200, 404]
- path: /_ingest/pipeline/movies_pipeline
method: DELETE
status: [200, 404]
version: '>= 2.11'
chapters:
- synopsis: Create a books ingest pipeline.
path: /_ingest/pipeline/{id}
method: PUT
parameters:
id: books_pipeline
request:
payload:
description: A books pipeline that does nothing.
processors: []
response:
status: 200
payload:
acknowledged: true
- synopsis: Create a movies ingest pipeline.
path: /_ingest/pipeline/{id}
method: PUT
parameters:
id: movies_pipeline
request:
payload:
description: A movies pipeline that does nothing.
processors: []
response:
status: 200
payload:
acknowledged: true
- synopsis: Query created books pipeline.
path: /_ingest/pipeline/{id}
method: GET
parameters:
id: books_pipeline
response:
status: 200
payload:
books_pipeline:
description: A books pipeline that does nothing.
- synopsis: Query all pipelines.
path: /_ingest/pipeline
method: GET
response:
status: 200
payload:
books_pipeline:
description: A books pipeline that does nothing.
movies_pipeline:
description: A movies pipeline that does nothing.
- synopsis: Delete the books pipeline.
path: /_ingest/pipeline/{id}
method: DELETE
parameters:
id: books_pipeline
response:
status: 200
86 changes: 86 additions & 0 deletions tests/default/ingest/pipeline/simulate.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,86 @@
$schema: ../../../../json_schemas/test_story.schema.yaml

description: Test the simulation of an ingest pipeline.
version: '>= 2.11'
epilogues:
- path: /_ingest/pipeline/movies_pipeline
method: DELETE
status: [200, 404]
prologues:
- path: /_ingest/pipeline/movies_pipeline
method: PUT
request:
payload:
description: A movies pipeline that does nothing.
processors: []
chapters:
- synopsis: Simulate an existing ingest pipeline (GET).
path: /_ingest/pipeline/{id}/_simulate
method: GET
parameters:
id: movies_pipeline
verbose: true
request:
payload:
docs:
- _index: movies
_id: '1'
_source:
title: The Cruise
director: Bennett Miller,
year: 1998
response:
status: 200
payload:
docs:
- processor_results: []
- synopsis: Simulate an existing ingest pipeline (POST).
path: /_ingest/pipeline/{id}/_simulate
method: POST
parameters:
id: movies_pipeline
request:
payload:
docs:
- _index: movies
_id: '1'
_source:
title: The Cruise
director: Bennett Miller,
year: 1998
response:
status: 200
- synopsis: Simulate an ingest pipeline with the pipeline in the request body (GET).
path: /_ingest/pipeline/_simulate
method: GET
request:
payload:
pipeline:
description: A movies pipeline that does nothing.
processors: []
docs:
- _index: movies
_id: '1'
_source:
title: The Cruise
director: Bennett Miller,
year: 1998
response:
status: 200
- synopsis: Simulate an ingest pipeline with the pipeline in the request body (POST).
path: /_ingest/pipeline/_simulate
method: POST
request:
payload:
pipeline:
description: A movies pipeline that does nothing.
processors: []
docs:
- _index: movies
_id: '1'
_source:
title: The Cruise
director: Bennett Miller,
year: 1998
response:
status: 200
16 changes: 16 additions & 0 deletions tests/default/ingest/processor/grok.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
$schema: ../../../../json_schemas/test_story.schema.yaml

description: Test retrieving grok processor patterns.
chapters:
- synopsis: Retrieve the patterns included with the grok processor.
path: /_ingest/processor/grok
method: GET
response:
status: 200
- synopsis: Retrieve the patterns included with the grok processor by key name.
path: /_ingest/processor/grok
method: GET
parameters:
s: true
response:
status: 200
Loading