Skip to content

Commit

Permalink
Fixed all refresh options to allow boolean and string.
Browse files Browse the repository at this point in the history
Signed-off-by: dblock <[email protected]>
  • Loading branch information
dblock committed Nov 14, 2024
1 parent 2fc3aee commit 19b8de1
Show file tree
Hide file tree
Showing 4 changed files with 98 additions and 13 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@ Inspired from [Keep a Changelog](https://keepachangelog.com/en/1.0.0/)
- Removed invalid `required` from `ppl` responses ([#646](https://github.com/opensearch-project/opensearch-api-specification/pull/646))
- 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 `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

0 comments on commit 19b8de1

Please sign in to comment.