forked from opensearch-project/OpenSearch
-
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 remove ingest processor handing ignore_missing parameter not corr…
…ectly (opensearch-project#10089) * Fix remove ingest processor handing ignore_missing parameter not correctly Signed-off-by: Gao Binlong <[email protected]> * modify change log Signed-off-by: Gao Binlong <[email protected]> * Fix test failure and optimize some code Signed-off-by: Gao Binlong <[email protected]> * Minor change Signed-off-by: Gao Binlong <[email protected]> * Modify test code Signed-off-by: Gao Binlong <[email protected]> * Split a test method to two Signed-off-by: Gao Binlong <[email protected]> --------- Signed-off-by: Gao Binlong <[email protected]>
- Loading branch information
1 parent
b83f433
commit c44337e
Showing
5 changed files
with
155 additions
and
17 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
93 changes: 93 additions & 0 deletions
93
...gest-common/src/yamlRestTest/resources/rest-api-spec/test/ingest/290_remove_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 |
---|---|---|
@@ -0,0 +1,93 @@ | ||
--- | ||
teardown: | ||
- do: | ||
ingest.delete_pipeline: | ||
id: "my_pipeline" | ||
ignore: 404 | ||
|
||
--- | ||
"Test remove processor with non-existing field and without ignore_missing": | ||
- do: | ||
ingest.put_pipeline: | ||
id: "my_pipeline" | ||
body: > | ||
{ | ||
"description": "_description", | ||
"processors": [ | ||
{ | ||
"remove" : { | ||
"field" : "{{unknown}}" | ||
} | ||
} | ||
] | ||
} | ||
- match: { acknowledged: true } | ||
|
||
- do: | ||
catch: /field path cannot be null nor empty/ | ||
index: | ||
index: test | ||
id: 1 | ||
pipeline: "my_pipeline" | ||
body: { message: "foo bar baz" } | ||
|
||
--- | ||
"Test remove processor with resolved field path doesn't exist": | ||
- do: | ||
ingest.put_pipeline: | ||
id: "my_pipeline" | ||
body: > | ||
{ | ||
"description": "_description", | ||
"processors": [ | ||
{ | ||
"remove" : { | ||
"field" : "{{foo}}" | ||
} | ||
} | ||
] | ||
} | ||
- match: { acknowledged: true } | ||
|
||
- do: | ||
catch: /field \[bar\] doesn\'t exist/ | ||
index: | ||
index: test | ||
id: 1 | ||
pipeline: "my_pipeline" | ||
body: { | ||
message: "foo bar baz", | ||
foo: "bar" | ||
} | ||
|
||
--- | ||
"Test remove processor with non-existing field and ignore_missing": | ||
- do: | ||
ingest.put_pipeline: | ||
id: "my_pipeline" | ||
body: > | ||
{ | ||
"description": "_description", | ||
"processors": [ | ||
{ | ||
"remove" : { | ||
"field" : "{{unknown}}", | ||
"ignore_missing" : true | ||
} | ||
} | ||
] | ||
} | ||
- match: { acknowledged: true } | ||
|
||
- do: | ||
index: | ||
index: test | ||
id: 1 | ||
pipeline: "my_pipeline" | ||
body: { message: "foo bar baz" } | ||
|
||
- do: | ||
get: | ||
index: test | ||
id: 1 | ||
- match: { _source.message: "foo bar baz" } |
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