-
Notifications
You must be signed in to change notification settings - Fork 61
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fixed query DSL
match
that supports a field name and value.
Signed-off-by: dblock <[email protected]>
- Loading branch information
Showing
4 changed files
with
254 additions
and
13 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,212 @@ | ||
$schema: ../../json_schemas/test_story.schema.yaml | ||
|
||
description: Test reindex. | ||
epilogues: | ||
- path: /movies | ||
method: DELETE | ||
status: [200, 404] | ||
- path: /films | ||
method: DELETE | ||
status: [200, 404] | ||
- path: /videos | ||
method: DELETE | ||
status: [200, 404] | ||
- path: /_ingest/pipeline/transform-and-count | ||
method: DELETE | ||
status: [200, 404] | ||
chapters: | ||
- synopsis: Create a document. | ||
path: /{index}/_doc | ||
method: POST | ||
parameters: | ||
index: movies | ||
request_body: | ||
payload: | ||
title: Beauty and the Beast | ||
year: 91 | ||
response: | ||
status: 201 | ||
- synopsis: Refresh the index. | ||
path: /{index}/_refresh | ||
method: POST | ||
parameters: | ||
index: movies | ||
- synopsis: Reindex from movies to films. | ||
path: /_reindex | ||
method: POST | ||
request_body: | ||
payload: | ||
source: | ||
index: movies | ||
dest: | ||
index: films | ||
response: | ||
status: 200 | ||
payload: | ||
total: 1 | ||
- synopsis: Reindex a subset of documents (match). | ||
path: /_reindex | ||
method: POST | ||
request_body: | ||
payload: | ||
source: | ||
index: movies | ||
query: | ||
match: | ||
title: Beauty and the Beast | ||
dest: | ||
index: films | ||
response: | ||
status: 200 | ||
payload: | ||
total: 1 | ||
- synopsis: Reindex a subset of documents (no match). | ||
path: /_reindex | ||
method: POST | ||
request_body: | ||
payload: | ||
source: | ||
index: movies | ||
query: | ||
match: | ||
title: Does not Exist | ||
dest: | ||
index: films | ||
response: | ||
status: 200 | ||
payload: | ||
total: 0 | ||
- synopsis: Combine two indexes. | ||
path: /_reindex | ||
method: POST | ||
request_body: | ||
payload: | ||
source: | ||
index: | ||
- movies | ||
- films | ||
dest: | ||
index: videos | ||
response: | ||
status: 200 | ||
payload: | ||
total: 1 | ||
- synopsis: Reindex only unique documents. | ||
path: /_reindex | ||
method: POST | ||
request_body: | ||
payload: | ||
conflicts: proceed | ||
source: | ||
index: movies | ||
dest: | ||
index: videos | ||
op_type: create | ||
response: | ||
status: 200 | ||
payload: | ||
total: 1 | ||
- synopsis: Transform documents during reindexing. | ||
path: /_reindex | ||
method: POST | ||
request_body: | ||
payload: | ||
source: | ||
index: movies | ||
dest: | ||
index: videos | ||
script: | ||
lang: painless | ||
source: ctx._source.year += 1900 | ||
response: | ||
status: 200 | ||
payload: | ||
total: 1 | ||
- synopsis: Create an ingest pipeline. | ||
path: /_ingest/pipeline/{id} | ||
method: PUT | ||
parameters: | ||
id: transform-and-count | ||
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 | ||
- 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 | ||
- Beast | ||
length: 4 | ||
title: Beauty and the Beast | ||
- synopsis: Update documents in the current index. | ||
path: /{index}/_update_by_query | ||
method: POST | ||
parameters: | ||
index: videos | ||
response: | ||
status: 200 | ||
payload: | ||
updated: 1 | ||
- synopsis: Reindex from movies to films with all options. | ||
path: /_reindex | ||
method: POST | ||
parameters: | ||
max_docs: 1 | ||
slices: 1 | ||
request_body: | ||
payload: | ||
source: | ||
index: movies | ||
size: 1 | ||
dest: | ||
index: films | ||
version_type: internal | ||
response: | ||
status: 200 | ||
payload: | ||
total: 1 |
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