Avoid PIT context exhaustion by pruning indices that cannot match - #5727
Avoid PIT context exhaustion by pruning indices that cannot match#5727dai-chen wants to merge 1 commit into
Conversation
PR Code Analyzer ❗AI-powered 'Code-Diff-Analyzer' found issues on commit b25d8b7.
The table above displays the top 10 most important findings. Pull Requests Author(s): Please update your Pull Request according to the report above. Repository Maintainer(s): You can Thanks. |
PR Reviewer Guide 🔍(Review updated until commit 1bbddad)Here are some key observations to aid the review process:
|
PR Code Suggestions ✨Latest suggestions up to 1bbddad Explore these optional code suggestions:
Previous suggestionsSuggestions up to commit 8a8c4c4
Suggestions up to commit 146b86f
Suggestions up to commit bd28765
Suggestions up to commit d447702
Suggestions up to commit b25d8b7
|
b25d8b7 to
d447702
Compare
|
Persistent review updated to latest commit d447702 |
d447702 to
bd28765
Compare
|
Persistent review updated to latest commit bd28765 |
bd28765 to
146b86f
Compare
|
Persistent review updated to latest commit 146b86f |
146b86f to
8a8c4c4
Compare
|
Persistent review updated to latest commit 8a8c4c4 |
Prune a wildcard index expression down to the indices that can hold data in the query's @timestamp range, so a scan over many indices no longer exhausts the per-node open PIT context limit. Off by default behind plugins.query.pruning.enabled, and skipped for an alias, a data stream, a cross-cluster expression, or a match list that is empty, excludes nothing or exceeds an internal cap. Signed-off-by: Chen Dai <daichen@amazon.com>
8a8c4c4 to
1bbddad
Compare
|
Persistent review updated to latest commit 1bbddad |
Description
Prunes a wildcard index expression down to the indices that can match the query's
@timestamprange before the PIT is created, so a scan over many time-bucketed indices no longer opens a reader context per shard of every matching index and exhaustssearch.max_open_pit_context._field_capswithindex_filter— Option A of the approaches weighed on the issue — driven by the resolved filter already sitting in the pushdown context.search.max_open_pit_context, so an expression matching more indices than the cap falls back to the wildcard and opens every context.Example
Three monthly indices, one shard each, one document each.
max_result_windowis 2 so thathead 5exceeds it and the query takes the PIT path, which is where pruning runs.No reader contexts opened yet:
Query a range only February can satisfy, with pruning at its default of
false:All three indices opened a reader context, including the two that cannot match:
{"indices": { "demo-2026-01": {"total": {"search": {"point_in_time_total": 1}}}, "demo-2026-02": {"total": {"search": {"point_in_time_total": 1}}}, "demo-2026-03": {"total": {"search": {"point_in_time_total": 1}}}}}Now recreate the indices to reset the counters, and enable pruning:
The same query returns the same row:
{"datarows": [["february"]], "total": 1, "size": 1}But only February was read — three reader contexts down to one:
{"indices": { "demo-2026-01": {"total": {"search": {"point_in_time_total": 0}}}, "demo-2026-02": {"total": {"search": {"point_in_time_total": 1}}}, "demo-2026-03": {"total": {"search": {"point_in_time_total": 0}}}}}Related Issues
Part of #5698
Check List
--signoffor-s.By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license.
For more information on following Developer Certificate of Origin and signing off your commits, please check here.