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

Misc fixes and tests. #673

Merged
merged 6 commits into from
Nov 18, 2024
Merged
Show file tree
Hide file tree
Changes from 1 commit
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
Prev Previous commit
Next Next commit
Fixed all refresh options to allow boolean and string.
Signed-off-by: dblock <dblock@amazon.com>
  • Loading branch information
dblock committed Nov 18, 2024
commit 8903287e6173267bc459b6532351922ba271669e
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@ Inspired from [Keep a Changelog](https://keepachangelog.com/en/1.0.0/)
- Added schema for security API error responses ([#646](https://github.com/opensearch-project/opensearch-api-specification/pull/646))
- Fixed `/{index}/_create/{id}` returning `201` ([#669](https://github.com/opensearch-project/opensearch-api-specification/pull/669))
- Fixed `ml._common.yaml#SearchModelsResponse` and `SearchModelsHitsHit` ([#672](https://github.com/opensearch-project/opensearch-api-specification/pull/672))
- Fixed `refresh` options to allow `boolean` and `string` ([#673](https://github.com/opensearch-project/opensearch-api-specification/pull/673))

## [0.1.0] - 2024-10-25

Expand Down
16 changes: 8 additions & 8 deletions spec/namespaces/_core.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -4012,7 +4012,7 @@ components:
name: refresh
description: If `true`, OpenSearch refreshes all shards involved in the delete by query after the request completes.
schema:
type: boolean
$ref: '../schemas/_common.yaml#/components/schemas/Refresh'
style: form
delete_by_query::query.request_cache:
in: query
Expand Down Expand Up @@ -4268,7 +4268,7 @@ components:
name: refresh
description: If `true`, OpenSearch refreshes all shards involved in the delete by query after the request completes.
schema:
type: boolean
$ref: '../schemas/_common.yaml#/components/schemas/Refresh'
style: form
exists::query.routing:
in: query
Expand Down Expand Up @@ -4364,7 +4364,7 @@ components:
name: refresh
description: If `true`, OpenSearch refreshes all shards involved in the delete by query after the request completes.
schema:
type: boolean
$ref: '../schemas/_common.yaml#/components/schemas/Refresh'
style: form
exists_source::query.routing:
in: query
Expand Down Expand Up @@ -4602,7 +4602,7 @@ components:
name: refresh
description: If true, OpenSearch refreshes the affected shards to make this operation visible to search. If false, do nothing with refreshes.
schema:
type: boolean
$ref: '../schemas/_common.yaml#/components/schemas/Refresh'
style: form
get::query.routing:
in: query
Expand Down Expand Up @@ -4717,7 +4717,7 @@ components:
name: refresh
description: If true, OpenSearch refreshes the affected shards to make this operation visible to search. If false, do nothing with refreshes.
schema:
type: boolean
$ref: '../schemas/_common.yaml#/components/schemas/Refresh'
style: form
get_source::query.routing:
in: query
Expand Down Expand Up @@ -4905,7 +4905,7 @@ components:
name: refresh
description: If `true`, the request refreshes relevant shards before retrieving documents.
schema:
type: boolean
$ref: '../schemas/_common.yaml#/components/schemas/Refresh'
style: form
mget::query.routing:
in: query
Expand Down Expand Up @@ -5249,7 +5249,7 @@ components:
name: refresh
description: If `true`, the request refreshes affected shards to make this operation visible to search.
schema:
type: boolean
$ref: '../schemas/_common.yaml#/components/schemas/Refresh'
style: form
reindex::query.requests_per_second:
in: query
Expand Down Expand Up @@ -6369,7 +6369,7 @@ components:
name: refresh
description: If `true`, OpenSearch refreshes affected shards to make the operation visible to search.
schema:
type: boolean
$ref: '../schemas/_common.yaml#/components/schemas/Refresh'
style: form
update_by_query::query.request_cache:
in: query
Expand Down
12 changes: 7 additions & 5 deletions spec/schemas/_common.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -767,11 +767,13 @@ components:
NodeName:
type: string
Refresh:
type: string
enum:
- 'false'
- 'true'
- wait_for
oneOf:
- type: boolean
- type: string
enum:
- 'false'
- 'true'
- wait_for
WaitForActiveShards:
oneOf:
- title: count
Expand Down
82 changes: 82 additions & 0 deletions tests/default/indices/update.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,82 @@
$schema: ../../../json_schemas/test_story.schema.yaml

description: Test updating a document.
epilogues:
- path: /movies
method: DELETE
status: [200, 404]
prologues:
- path: /movies/_doc/1
method: POST
parameters:
refresh: true
request:
payload:
title: Beauty and the Beast
year: 1990
chapters:
- synopsis: Update a document in the index.
path: /{index}/_update/{id}
method: POST
parameters:
index: movies
id: '1'
refresh: true
request:
payload:
doc:
title: Beauty and the Beast
year: 1991
response:
status: 200
payload:
result: updated
- synopsis: Update a document in the index using a script.
path: /{index}/_update/{id}
method: POST
parameters:
index: movies
id: '1'
request:
payload:
script:
source: ctx._source.year += params.value
lang: painless
params:
value: 10
response:
status: 200
payload:
result: updated
- synopsis: Upsert a document.
path: /{index}/_update/{id}
method: POST
parameters:
index: movies
id: '1'
request:
payload:
doc:
title: Drive
upsert:
title: Drive
response:
status: 200
payload:
result: updated
- synopsis: Upsert a document (doc_as_upsert).
path: /{index}/_update/{id}
method: POST
parameters:
index: movies
id: '1'
request:
payload:
doc:
title: Drive
year: 2011
doc_as_upsert: true
response:
status: 200
payload:
result: updated