Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Bugfix] Better exception handling in search pipelines #7735

Merged
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -122,3 +122,23 @@ teardown:
index: test
body: { }
- match: { hits.total.value: 2 }
---
"Test invalid inline query":
- do:
catch: bad_request
search:
index: test
body: {
search_pipeline: {
"request_processors": [
"filter_query": {
"query": {
"woozlewuzzle": {
"field": "foo"
}
}
}
]
}
}
- match: { status: 400 }
reta marked this conversation as resolved.
Show resolved Hide resolved
Original file line number Diff line number Diff line change
Expand Up @@ -401,7 +401,7 @@
);
} catch (Exception e) {
originalListener.onFailure(e);
throw new RuntimeException(e);
return;

Check warning on line 404 in server/src/main/java/org/opensearch/action/search/TransportSearchAction.java

View check run for this annotation

Codecov / codecov/patch

server/src/main/java/org/opensearch/action/search/TransportSearchAction.java#L404

Added line #L404 was not covered by tests
}

ActionListener<SearchSourceBuilder> rewriteListener = ActionListener.wrap(source -> {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -400,8 +400,12 @@
pipeline = pipelineHolder.pipeline;
}
}
SearchRequest transformedRequest = pipeline.transformRequest(searchRequest);
return new PipelinedRequest(pipeline, transformedRequest);
try {
SearchRequest transformedRequest = pipeline.transformRequest(searchRequest);
return new PipelinedRequest(pipeline, transformedRequest);
} catch (Exception e) {
throw new SearchPipelineProcessingException(e);

Check warning on line 407 in server/src/main/java/org/opensearch/search/pipeline/SearchPipelineService.java

View check run for this annotation

Codecov / codecov/patch

server/src/main/java/org/opensearch/search/pipeline/SearchPipelineService.java#L406-L407

Added lines #L406 - L407 were not covered by tests
}
}

Map<String, Processor.Factory<SearchRequestProcessor>> getRequestProcessorFactories() {
Expand Down