Skip to content

Commit

Permalink
Merge branch 'main' into simulate-tests
Browse files Browse the repository at this point in the history
Signed-off-by: Theo N. Truong <theotr@amazon.com>
  • Loading branch information
nhtruong authored Nov 26, 2024
2 parents e318d91 + c888a16 commit 73d547d
Show file tree
Hide file tree
Showing 26 changed files with 412 additions and 128 deletions.
5 changes: 4 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,9 +16,11 @@ 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 `rename_alias_pattern` and `rename_alias_replacment` to `/_snapshot/{repository}/{snapshot}/_restore` body parameters ([#615](https://github.com/opensearch-project/opensearch-api-specification/pull/615))
- Added `rename_alias_pattern` and `rename_alias_replacement` to `/_snapshot/{repository}/{snapshot}/_restore` body parameters ([#615](https://github.com/opensearch-project/opensearch-api-specification/pull/615))
- Added `resource_stats` to `TaskInfoBase` ([#692](https://github.com/opensearch-project/opensearch-api-specification/pull/692))
- Added `s` to `/_ingest/processor/grok` ([#689](https://github.com/opensearch-project/opensearch-api-specification/pull/689))
- Added schema for security API error responses ([#646](https://github.com/opensearch-project/opensearch-api-specification/pull/646))
- Added `aggregations` to `/nodes/_usage/{metric}` requests and responses ([#615](https://github.com/opensearch-project/opensearch-api-specification/pull/615))

### 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 @@ -42,6 +44,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 response schema for `/_nodes/reload_secure_settings` and `/_nodes/{node_id}/reload_secure_settings` ([#694](https://github.com/opensearch-project/opensearch-api-specification/pull/694))
- Fixed `/_ingest/pipeline/{id}/_simulate` response `docs/_source` field schema ([#689](https://github.com/opensearch-project/opensearch-api-specification/pull/689))

### Changed
Expand Down
39 changes: 39 additions & 0 deletions spec/schemas/_common.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2338,3 +2338,42 @@ components:
type: string
enum:
- index_or_alias
ResourceStats:
type: object
properties:
average:
$ref: '#/components/schemas/ResourceStat'
total:
$ref: '#/components/schemas/ResourceStat'
min:
$ref: '#/components/schemas/ResourceStat'
max:
$ref: '#/components/schemas/ResourceStat'
thread_info:
$ref: '#/components/schemas/ThreadInfo'
required:
- average
- max
- min
- thread_info
- total
ResourceStat:
type: object
properties:
cpu_time_in_nanos:
$ref: '#/components/schemas/DurationValueUnitNanos'
memory_in_bytes:
$ref: '#/components/schemas/ByteCount'
required:
- cpu_time_in_nanos
- memory_in_bytes
ThreadInfo:
type: object
properties:
thread_executions:
type: number
active_threads:
type: number
required:
- active_threads
- thread_executions
15 changes: 10 additions & 5 deletions spec/schemas/nodes._common.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -187,8 +187,8 @@ components:
_nodes:
$ref: '_common.yaml#/components/schemas/NodeStatistics'
NodeReloadResult:
oneOf:
- $ref: '#/components/schemas/Stats'
anyOf:
- $ref: '#/components/schemas/NodeReloadResponse'
- $ref: '#/components/schemas/NodeReloadError'
Stats:
type: object
Expand Down Expand Up @@ -1299,15 +1299,20 @@ components:
replica_rejections:
description: Number of indexing requests rejected in the replica stage.
type: number
NodeReloadError:
NodeReloadResponse:
type: object
properties:
name:
$ref: '_common.yaml#/components/schemas/Name'
reload_exception:
$ref: '_common.yaml#/components/schemas/ErrorCause'
required:
- name
NodeReloadError:
allOf:
- $ref: '#/components/schemas/NodeReloadResponse'
- type: object
properties:
reload_exception:
$ref: '_common.yaml#/components/schemas/ErrorCause'
SampleType:
type: string
description: The type to sample.
Expand Down
3 changes: 1 addition & 2 deletions spec/schemas/nodes.usage.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ components:
type: string
enum:
- _all
- aggregations
- rest_actions
ResponseBase:
allOf:
Expand Down Expand Up @@ -41,7 +42,5 @@ components:
additionalProperties:
type: object
required:
- aggregations
- rest_actions
- since
- timestamp
2 changes: 2 additions & 0 deletions spec/schemas/tasks._common.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,8 @@ components:
type: string
parent_task_id:
$ref: '_common.yaml#/components/schemas/TaskId'
resource_stats:
$ref: '_common.yaml#/components/schemas/ResourceStats'
required:
- action
- cancellable
Expand Down
12 changes: 12 additions & 0 deletions tests/default/_core/list.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
$schema: ../../../json_schemas/test_story.schema.yaml

description: Test _list operations.
# TODO: Re-enable in 3.0, see https://github.com/opensearch-project/opensearch-api-specification/pull/613
version: '>= 2.18 < 3.0'
chapters:
- synopsis: Returns available list APIs.
path: /_list
method: GET
response:
status: 200
content_type: text/plain
28 changes: 28 additions & 0 deletions tests/default/_core/mapping/field.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
$schema: ../../../../json_schemas/test_story.schema.yaml

description: Test field mappings.
prologues:
- path: /{index}
method: PUT
parameters:
index: movies
request:
payload:
mappings:
properties:
director:
type: text
year:
type: integer
epilogues:
- path: /movies
method: DELETE
status: [200, 404]
chapters:
- synopsis: Get field mappings across multiple indexes.
path: /_mapping/field/{fields}
method: GET
parameters:
fields: year
response:
status: 200
20 changes: 19 additions & 1 deletion tests/default/_core/mget.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ prologues:
- {create: {_index: movies, _id: movie2}}
- {director: Nicolas Winding Refn, title: Drive, year: 1960}
chapters:
- synopsis: Retrieve documents from multiple indexes.
- synopsis: Retrieve documents from multiple indexes (GET).
path: /_mget
method: GET
request:
Expand All @@ -45,3 +45,21 @@ chapters:
_id: movie1
- _index: books
_id: book1
- synopsis: Retrieve documents from multiple indexes (POST).
path: /_mget
method: POST
request:
payload:
docs:
- _index: books
_id: book1
- _index: movies
_id: movie1
response:
status: 200
payload:
docs:
- _index: books
_id: book1
- _index: movies
_id: movie1
10 changes: 5 additions & 5 deletions tests/default/flow_framework/deprovision.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ description: Test flow_framework provision endpoints.
version: '>= 2.12'
prologues:
- path: /_plugins/_flow_framework/workflow
id: create_flow_framework
id: workflow
method: POST
parameters:
use_case: semantic_search_with_cohere_embedding_query_enricher
Expand All @@ -12,24 +12,24 @@ prologues:
payload:
create_connector.credential.key: test_api_key
output:
test_workflow_id: payload.workflow_id
workflow_id: payload.workflow_id
epilogues:
- path: /_plugins/_flow_framework/workflow/{workflow_id}/_deprovision
method: POST
status: [200, 404]
parameters:
workflow_id: ${create_flow_framework.test_workflow_id}
workflow_id: ${workflow.workflow_id}
- path: /_plugins/_flow_framework/workflow/{workflow_id}
method: DELETE
status: [200, 404]
parameters:
workflow_id: ${create_flow_framework.test_workflow_id}
workflow_id: ${workflow.workflow_id}
chapters:
- synopsis: Deprovision workflow.
path: /_plugins/_flow_framework/workflow/{workflow_id}/_deprovision
method: POST
parameters:
workflow_id: ${create_flow_framework.test_workflow_id}
workflow_id: ${workflow.workflow_id}
response:
status: 200
- synopsis: Deprovision workflow using an invalid ID.
Expand Down
10 changes: 5 additions & 5 deletions tests/default/flow_framework/provision.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -3,31 +3,31 @@ description: Test flow_framework provision endpoints.
version: '>= 2.12'
prologues:
- path: /_plugins/_flow_framework/workflow
id: create_flow_framework
id: workflow
method: POST
parameters:
use_case: semantic_search_with_cohere_embedding_query_enricher
request:
payload:
create_connector.credential.key: test_api_key
output:
test_workflow_id: payload.workflow_id
workflow_id: payload.workflow_id
epilogues:
- path: /_plugins/_flow_framework/workflow/{workflow_id}/_deprovision
method: POST
parameters:
workflow_id: ${create_flow_framework.test_workflow_id}
workflow_id: ${workflow.workflow_id}
- path: /_plugins/_flow_framework/workflow/{workflow_id}
method: DELETE
status: [200, 404]
parameters:
workflow_id: ${create_flow_framework.test_workflow_id}
workflow_id: ${workflow.workflow_id}
chapters:
- synopsis: Provision workflow.
path: /_plugins/_flow_framework/workflow/{workflow_id}/_provision
method: POST
parameters:
workflow_id: ${create_flow_framework.test_workflow_id}
workflow_id: ${workflow.workflow_id}
request:
payload:
openai_key: '1234556'
Expand Down
6 changes: 3 additions & 3 deletions tests/default/flow_framework/search.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -3,21 +3,21 @@ description: Test flow_framework provision endpoints.
version: '>= 2.12'
prologues:
- path: /_plugins/_flow_framework/workflow
id: create_flow_framework
id: workflow
method: POST
parameters:
use_case: semantic_search_with_cohere_embedding_query_enricher
request:
payload:
create_connector.credential.key: test_api_key
output:
test_workflow_id: payload.workflow_id
workflow_id: payload.workflow_id
epilogues:
- path: /_plugins/_flow_framework/workflow/{workflow_id}
method: DELETE
status: [200, 404]
parameters:
workflow_id: ${create_flow_framework.test_workflow_id}
workflow_id: ${workflow.workflow_id}
chapters:
- synopsis: Search workflow match the name.
path: /_plugins/_flow_framework/workflow/_search
Expand Down
6 changes: 3 additions & 3 deletions tests/default/flow_framework/search_state.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -3,21 +3,21 @@ description: Test flow_framework provision endpoints.
version: '>= 2.12'
prologues:
- path: /_plugins/_flow_framework/workflow
id: create_flow_framework
id: workflow
method: POST
parameters:
use_case: semantic_search_with_cohere_embedding_query_enricher
request:
payload:
create_connector.credential.key: test_api_key
output:
test_workflow_id: payload.workflow_id
workflow_id: payload.workflow_id
epilogues:
- path: /_plugins/_flow_framework/workflow/{workflow_id}
method: DELETE
status: [200, 404]
parameters:
workflow_id: ${create_flow_framework.test_workflow_id}
workflow_id: ${workflow.workflow_id}
chapters:
- synopsis: Search workflow state.
path: /_plugins/_flow_framework/workflow/state/_search
Expand Down
8 changes: 4 additions & 4 deletions tests/default/flow_framework/status.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -3,27 +3,27 @@ description: Test flow_framework provision endpoints.
version: '>= 2.12'
prologues:
- path: /_plugins/_flow_framework/workflow
id: create_flow_framework
id: workflow
method: POST
parameters:
use_case: semantic_search_with_cohere_embedding_query_enricher
request:
payload:
create_connector.credential.key: test_api_key
output:
test_workflow_id: payload.workflow_id
workflow_id: payload.workflow_id
epilogues:
- path: /_plugins/_flow_framework/workflow/{workflow_id}
method: DELETE
status: [200, 404]
parameters:
workflow_id: ${create_flow_framework.test_workflow_id}
workflow_id: ${workflow.workflow_id}
chapters:
- synopsis: Get workflow status.
path: /_plugins/_flow_framework/workflow/{workflow_id}/_status
method: GET
parameters:
workflow_id: ${create_flow_framework.test_workflow_id}
workflow_id: ${workflow.workflow_id}
response:
status: 200
payload:
Expand Down
8 changes: 4 additions & 4 deletions tests/default/flow_framework/steps.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -3,28 +3,28 @@ description: Test flow_framework provision endpoints.
version: '>= 2.12'
prologues:
- path: /_plugins/_flow_framework/workflow
id: create_flow_framework
id: workflow
method: POST
parameters:
use_case: semantic_search_with_cohere_embedding_query_enricher
request:
payload:
create_connector.credential.key: test_api_key
output:
test_workflow_id: payload.workflow_id
workflow_id: payload.workflow_id
epilogues:
- path: /_plugins/_flow_framework/workflow/{workflow_id}
method: DELETE
status: [200, 404]
parameters:
workflow_id: ${create_flow_framework.test_workflow_id}
workflow_id: ${workflow.workflow_id}
chapters:
- synopsis: Get workflow steps.
path: /_plugins/_flow_framework/workflow/_steps
method: GET
response:
status: 200
- synopsis: Get workflow steps with invalid query parameter.
- synopsis: Get workflow steps with an invalid query parameter.
path: /_plugins/_flow_framework/workflow/_steps
method: GET
parameters:
Expand Down
Loading

0 comments on commit 73d547d

Please sign in to comment.