Skip to content

Commit 751ad99

Browse files
committed
Fix query timeout handling by checking searchContext.isSearchTimedOut()
Signed-off-by: Andriy Redko <[email protected]>
1 parent b5f651f commit 751ad99

File tree

2 files changed

+5
-0
lines changed

2 files changed

+5
-0
lines changed

Diff for: CHANGELOG.md

+1
Original file line numberDiff line numberDiff line change
@@ -74,6 +74,7 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
7474
- Skip remote-repositories validations for node-joins when RepositoriesService is not in sync with cluster-state ([#16763](https://github.com/opensearch-project/OpenSearch/pull/16763))
7575
- Fix _list/shards API failing when closed indices are present ([#16606](https://github.com/opensearch-project/OpenSearch/pull/16606))
7676
- Fix remote shards balance ([#15335](https://github.com/opensearch-project/OpenSearch/pull/15335))
77+
- Fix query timeout handling by checking searchContext.isSearchTimedOut() ([#16882](https://github.com/opensearch-project/OpenSearch/pull/16882))
7778

7879
### Security
7980

Diff for: server/src/main/java/org/opensearch/search/internal/ContextIndexSearcher.java

+4
Original file line numberDiff line numberDiff line change
@@ -305,6 +305,10 @@ protected void search(List<LeafReaderContext> leaves, Weight weight, Collector c
305305
*/
306306
@Override
307307
protected void searchLeaf(LeafReaderContext ctx, Weight weight, Collector collector) throws IOException {
308+
// If search is already flagged as timed out, do not continue
309+
if (searchContext.isSearchTimedOut()) {
310+
return;
311+
}
308312

309313
// Check if at all we need to call this leaf for collecting results.
310314
if (canMatch(ctx) == false) {

0 commit comments

Comments
 (0)