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

Add tests for SplitResponseProcessor #526

Merged
merged 5 commits into from
Aug 26, 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: 1 addition & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@ Inspired from [Keep a Changelog](https://keepachangelog.com/en/1.0.0/)
- Added API spec for security plugin ([#271](https://github.com/opensearch-project/opensearch-api-specification/pull/271))
- Added `/_plugins/_security/api/certificates/` ([#439](https://github.com/opensearch-project/opensearch-api-specification/pull/439))
- Added `/_plugins/_ml/models/{model_id}/_deploy`, `_undeploy` and `knn_vector` type in `passage_embedding` ([#504](https://github.com/opensearch-project/opensearch-api-specification/pull/504))
- Added `PersonalizeSearchRanking`, `RetrievalAugmentedGeneration`, `Rerank`, `Collapse`, `TruncateHits` and `SplitResponseProcessor` ([#505](https://github.com/opensearch-project/opensearch-api-specification/pull/505))
- Added `PersonalizeSearchRanking`, `RetrievalAugmentedGeneration`, `Rerank`, `Collapse`, `TruncateHits`, `SortResponseProcessor` and `SplitResponseProcessor` ([#505](https://github.com/opensearch-project/opensearch-api-specification/pull/505))
- Added `/_plugins/_security/api/certificates/` to API spec ([#439](https://github.com/opensearch-project/opensearch-api-specification/pull/439))
- Added support for annotating and testing the API spec against multiple OpenSearch distributions ([#483](https://github.com/opensearch-project/opensearch-api-specification/pull/483))
- Added `read_time`, `write_time`, `queue_size` and `io_time_in_millis` to `IoStatDevice` ([#483](https://github.com/opensearch-project/opensearch-api-specification/pull/483))
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
$schema: ../../../../../../json_schemas/test_story.schema.yaml

description: |-
Test the creation of a search pipeline with a response processor.
Test the creation of a search pipeline with a filter_query request processor.
version: '>= 2.8'
prologues:
- path: /_bulk
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,81 @@
$schema: ../../../../../../json_schemas/test_story.schema.yaml

description: |-
Test the creation of a search pipeline with split and sort response processors.
version: '>= 2.17'
prologues:
- path: /numbers/_doc/1
method: POST
parameters:
refresh: true
request:
payload:
number_string:
- 'zero,one,two,three'
status: [201]
epilogues:
- path: /_search/pipeline/numbers_pipeline
method: DELETE
status: [200, 404]
- path: /numbers
method: DELETE
status: [200, 404]
chapters:
- synopsis: Create search pipeline.
path: /_search/pipeline/{id}
method: PUT
parameters:
id: numbers_pipeline
request:
payload:
response_processors:
- split:
field: number_string
separator: ','
target_field: number_strings
- sort:
field: number_strings
order: asc
target_field: sorted_number_strings
response:
status: 200
payload:
acknowledged: true
- synopsis: Query created pipeline.
path: /_search/pipeline/{id}
method: GET
parameters:
id: numbers_pipeline
response:
status: 200
- synopsis: Search.
warnings:
multiple-paths-detected: false
path: /{index}/_search
method: GET
parameters:
index: numbers
search_pipeline: numbers_pipeline
response:
status: 200
payload:
hits:
total:
value: 1
hits:
- _index: numbers
_source:
number_string:
- 'zero,one,two,three'
number_strings:
# eslint-disable yml/sort-sequence-values
- zero
- one
- two
- three
# eslint-enable yml/sort-sequence-values
sorted_number_strings:
- one
- three
- two
- zero
Loading