forked from opensearch-project/opensearch-api-specification
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fix: _update_by_query with a term. (opensearch-project#451)
Signed-off-by: dblock <[email protected]>
- Loading branch information
Showing
6 changed files
with
161 additions
and
74 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,84 @@ | ||
$schema: ../../../json_schemas/test_story.schema.yaml | ||
|
||
description: Test reindex with a Search pipeline. | ||
epilogues: | ||
- path: /movies | ||
method: DELETE | ||
status: [200, 404] | ||
- path: /videos | ||
method: DELETE | ||
status: [200, 404] | ||
- path: /_ingest/pipeline/transform-and-count | ||
method: DELETE | ||
status: [200, 404] | ||
prologues: | ||
- path: /_ingest/pipeline/transform-and-count | ||
method: PUT | ||
request_body: | ||
payload: | ||
description: | | ||
Splits the `title`` field into a `words` list. | ||
Computes the length of the title field and stores it in a new `length` field. | ||
Removes the `year` field. | ||
processors: | ||
- split: | ||
field: title | ||
separator: '\s+' | ||
target_field: words | ||
- script: | ||
lang: painless | ||
source: ctx.length = ctx.words.length | ||
- remove: | ||
field: year | ||
- path: /{index}/_doc | ||
method: POST | ||
parameters: | ||
index: movies | ||
refresh: true | ||
request_body: | ||
payload: | ||
title: Beauty and the Beast | ||
year: 91 | ||
status: [201] | ||
chapters: | ||
- synopsis: Transform documents using a pipeline. | ||
path: /_reindex | ||
method: POST | ||
request_body: | ||
payload: | ||
source: | ||
index: movies | ||
dest: | ||
index: videos | ||
pipeline: transform-and-count | ||
response: | ||
status: 200 | ||
- synopsis: Refresh the index. | ||
path: /{index}/_refresh | ||
method: POST | ||
parameters: | ||
index: videos | ||
- synopsis: Get all videos. | ||
path: /{index}/_search | ||
method: POST | ||
parameters: | ||
index: videos | ||
request_body: | ||
payload: | ||
query: | ||
match_all: {} | ||
response: | ||
status: 200 | ||
payload: | ||
hits: | ||
hits: | ||
- _index: videos | ||
_source: | ||
words: | ||
- Beauty | ||
- and | ||
- the | ||
# eslint-disable-next-line yml/sort-sequence-values | ||
- Beast | ||
length: 4 | ||
title: Beauty and the Beast |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,72 @@ | ||
$schema: ../../json_schemas/test_story.schema.yaml | ||
|
||
description: Test reindex. | ||
epilogues: | ||
- path: /books | ||
method: DELETE | ||
status: [200, 404] | ||
prologues: | ||
- path: /_bulk | ||
method: POST | ||
parameters: | ||
refresh: true | ||
request_body: | ||
content_type: application/x-ndjson | ||
payload: | ||
- {create: {_index: books, _id: book_1392214}} | ||
- {author: Harper Lee, title: To Kill a Mockingbird, year: 60} | ||
- {create: {_index: books, _id: book_1392215}} | ||
- {author: Elizabeth Rudnick, title: Beauty and the Beast, year: 91} | ||
chapters: | ||
- synopsis: Update documents in the index. | ||
path: /{index}/_update_by_query | ||
method: POST | ||
parameters: | ||
index: books | ||
refresh: true | ||
response: | ||
status: 200 | ||
payload: | ||
updated: 2 | ||
- synopsis: Update documents in the index (full query term, script). | ||
path: /{index}/_update_by_query | ||
method: POST | ||
parameters: | ||
index: books | ||
request_body: | ||
payload: | ||
query: | ||
term: | ||
title: | ||
_name: title | ||
value: beauty | ||
case_insensitive: true | ||
boost: 1 | ||
script: | ||
source: ctx._source.year += params.century | ||
lang: painless | ||
params: | ||
century: 1900 | ||
response: | ||
status: 200 | ||
payload: | ||
updated: 1 | ||
- synopsis: Update documents in the index (simple term, script). | ||
path: /{index}/_update_by_query | ||
method: POST | ||
parameters: | ||
index: books | ||
request_body: | ||
payload: | ||
query: | ||
term: | ||
year: 60 | ||
script: | ||
source: ctx._source.year += params.century | ||
lang: painless | ||
params: | ||
century: 1900 | ||
response: | ||
status: 200 | ||
payload: | ||
updated: 1 |