-
Notifications
You must be signed in to change notification settings - Fork 24.8k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[7.17] Ingest correctly handle upsert operations and drop processors …
- Loading branch information
Showing
5 changed files
with
289 additions
and
113 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
pr: 104585 | ||
summary: Ingest correctly handle upsert operations and drop processors together | ||
area: Ingest Node | ||
type: bug | ||
issues: | ||
- 36746 |
249 changes: 170 additions & 79 deletions
249
...ingest-common/src/yamlRestTest/resources/rest-api-spec/test/ingest/220_drop_processor.yml
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 |
---|---|---|
@@ -1,94 +1,185 @@ | ||
--- | ||
teardown: | ||
- do: | ||
ingest.delete_pipeline: | ||
id: "my_pipeline" | ||
ignore: 404 | ||
- do: | ||
indices.delete: | ||
index: "test" | ||
ignore_unavailable: true | ||
- do: | ||
ingest.delete_pipeline: | ||
id: "my_pipeline" | ||
ignore: 404 | ||
|
||
--- | ||
"Test Drop Processor": | ||
- do: | ||
ingest.put_pipeline: | ||
id: "my_pipeline" | ||
body: > | ||
{ | ||
"description" : "pipeline with drop", | ||
"processors" : [ | ||
{ | ||
"drop" : { | ||
"if": "ctx.foo == 'bar'" | ||
- do: | ||
ingest.put_pipeline: | ||
id: "my_pipeline" | ||
body: > | ||
{ | ||
"description" : "pipeline with drop", | ||
"processors" : [ | ||
{ | ||
"drop" : { | ||
"if": "ctx.foo == 'bar'" | ||
} | ||
} | ||
} | ||
] | ||
] | ||
} | ||
- match: { acknowledged: true } | ||
|
||
- do: | ||
index: | ||
index: test | ||
id: "1" | ||
pipeline: "my_pipeline" | ||
body: { | ||
foo: "bar" | ||
} | ||
- match: { acknowledged: true } | ||
|
||
- do: | ||
index: | ||
index: test | ||
id: "1" | ||
pipeline: "my_pipeline" | ||
body: { | ||
foo: "bar" | ||
} | ||
|
||
- do: | ||
index: | ||
index: test | ||
id: "2" | ||
pipeline: "my_pipeline" | ||
body: { | ||
foo: "blub" | ||
} | ||
|
||
- do: | ||
catch: missing | ||
get: | ||
index: test | ||
id: "1" | ||
- match: { found: false } | ||
|
||
- do: | ||
get: | ||
index: test | ||
id: "2" | ||
- match: { _source.foo: "blub" } | ||
|
||
- do: | ||
index: | ||
index: test | ||
id: "2" | ||
pipeline: "my_pipeline" | ||
body: { | ||
foo: "blub" | ||
} | ||
|
||
- do: | ||
catch: missing | ||
get: | ||
index: test | ||
id: "1" | ||
- match: { found: false } | ||
|
||
- do: | ||
get: | ||
index: test | ||
id: "2" | ||
- match: { _source.foo: "blub" } | ||
|
||
--- | ||
"Test Drop Processor On Failure": | ||
- do: | ||
ingest.put_pipeline: | ||
id: "my_pipeline_with_failure" | ||
body: > | ||
{ | ||
"description" : "pipeline with on failure drop", | ||
"processors": [ | ||
- do: | ||
ingest.put_pipeline: | ||
id: "my_pipeline_with_failure" | ||
body: > | ||
{ | ||
"description" : "pipeline with on failure drop", | ||
"processors": [ | ||
{ | ||
"fail": { | ||
"message": "failed", | ||
"on_failure": [ | ||
{ | ||
"drop": {} | ||
} | ||
] | ||
} | ||
} | ||
] | ||
} | ||
- match: { acknowledged: true } | ||
|
||
- do: | ||
index: | ||
index: test | ||
id: "3" | ||
pipeline: "my_pipeline_with_failure" | ||
body: { | ||
foo: "bar" | ||
} | ||
|
||
- do: | ||
catch: missing | ||
get: | ||
index: test | ||
id: "3" | ||
|
||
--- | ||
"Test Drop Processor with Upsert (_bulk)": | ||
- skip: | ||
version: ' - 7.17.17' | ||
reason: 'https://github.com/elastic/elasticsearch/issues/36746 fixed in 7.17.18' | ||
- do: | ||
ingest.put_pipeline: | ||
id: "my_pipeline" | ||
body: > | ||
{ | ||
"processors": [ | ||
{ | ||
"fail": { | ||
"message": "failed", | ||
"on_failure": [ | ||
{ | ||
"drop": {} | ||
} | ||
] | ||
"drop": { | ||
} | ||
} | ||
] | ||
} | ||
- match: { acknowledged: true } | ||
|
||
- do: | ||
index: | ||
index: test | ||
id: "3" | ||
pipeline: "my_pipeline_with_failure" | ||
body: { | ||
foo: "bar" | ||
} | ||
|
||
- do: | ||
catch: missing | ||
get: | ||
index: test | ||
id: "3" | ||
} | ||
- match: { acknowledged: true } | ||
|
||
- do: | ||
bulk: | ||
refresh: true | ||
pipeline: "my_pipeline" | ||
body: | ||
- update: | ||
_index: test | ||
_id: 4 | ||
- '{"upsert":{"some":"fields"},"script":"ctx"}' | ||
- match: { errors: false } | ||
- match: { items.0.update._index: test } | ||
- match: { items.0.update._id: "4" } | ||
- match: { items.0.update._version: -3 } | ||
- match: { items.0.update.result: noop } | ||
- match: { items.0.update.status: 200 } | ||
|
||
- do: | ||
catch: missing | ||
get: | ||
index: test | ||
id: "4" | ||
|
||
--- | ||
"Test Drop Processor with Upsert (_update)": | ||
- skip: | ||
version: ' - 7.17.17' | ||
reason: 'https://github.com/elastic/elasticsearch/issues/36746 fixed in 7.17.18' | ||
- do: | ||
ingest.put_pipeline: | ||
id: "my_pipeline" | ||
body: > | ||
{ | ||
"processors": [ | ||
{ | ||
"drop": { | ||
} | ||
} | ||
] | ||
} | ||
- match: { acknowledged: true } | ||
|
||
- do: | ||
indices.create: | ||
index: test | ||
body: | ||
settings: | ||
index: | ||
default_pipeline: "my_pipeline" | ||
|
||
- do: | ||
update: | ||
index: test | ||
id: "5" | ||
body: | ||
script: | ||
source: "ctx._source.foo = 'bar'" | ||
upsert: | ||
foo: "bar" | ||
|
||
- match: { _index: test } | ||
- match: { _id: "5" } | ||
- match: { result: noop } | ||
|
||
- do: | ||
catch: missing | ||
get: | ||
index: test | ||
id: "5" |
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
Oops, something went wrong.