Skip to content

Commit

Permalink
Add ignore_failure to 40_rename_response
Browse files Browse the repository at this point in the history
Signed-off-by: Mingshi Liu <mingshl@amazon.com>
  • Loading branch information
mingshl committed Jun 30, 2023
1 parent 0d66d76 commit 21ab713
Show file tree
Hide file tree
Showing 2 changed files with 31 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,26 @@ teardown:
}
- match: { acknowledged: true }

- do:
search_pipeline.put:
id: "my_pipeline_4"
body: >
{
"description": "test pipeline with ignore missing false and ignore failure true",
"response_processors": [
{
"rename_field":
{
"field": "aa",
"target_field": "b",
"ignore_missing": false,
"ignore_failure": true
}
}
]
}
- match: { acknowledged: true }

- do:
indices.create:
index: test
Expand Down Expand Up @@ -128,6 +148,15 @@ teardown:
search_pipeline: "my_pipeline_3"
- match: { error.type: "illegal_argument_exception" }

# Pipeline with ignore_missing set to true and ignore_failure set to true
# Should return while catching error
- do:
search:
index: test
search_pipeline: "my_pipeline_4"
- match: { hits.total.value: 1 }
- match: {hits.hits.0._source: { "a": "foo" } }

# No source, using stored_fields
- do:
search:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -137,13 +137,13 @@ SearchRequest transformRequest(SearchRequest request) throws SearchPipelineProce
try {
request = processor.processRequest(request);
} catch (Exception e) {
onRequestProcessorFailed(processor);
if (processor.getIgnoreFailure()) {
processorFailureCount = processorFailureCount + 1;
logger.info("failed to process request process: " + processor.getType());
logger.error("An error occurred in the processor", e);
logger.info("the number of failing pipeline increments to " + processorFailureCount);
} else {
onRequestProcessorFailed(processor);
throw e;
}
} finally {
Expand Down Expand Up @@ -173,13 +173,13 @@ SearchResponse transformResponse(SearchRequest request, SearchResponse response)
try {
response = processor.processResponse(request, response);
} catch (Exception e) {
onResponseProcessorFailed(processor);
if (processor.getIgnoreFailure()) {
processorFailureCount = processorFailureCount + 1;
logger.info("failed to process response process: " + processor.getType());
logger.error("An error occurred in the processor", e);
logger.info("the number of failing pipeline increments to " + processorFailureCount);
} else {
onRequestProcessorFailed(processor);
throw e;
}
} finally {
Expand Down

0 comments on commit 21ab713

Please sign in to comment.