Describe the bug
When searching an index pattern or alias with indices having large number of shards results in OOM for coordinator node if the shards.
When we make a search request spans large number of shards with each shard having significant result size, this triggers OOM. This happens because at coordinator node we buffer batched_reduce_size shard level query phase results in QueryPhaseResultConsumer class before we submit the merge for these buffered results on a separate thread.
The default value for this is quite high and CircuitBreaker doesn't break for these shard level results memory footprint.
Related component
No response
To Reproduce
- Go to '...'
- Click on '....'
- Scroll down to '....'
- See error
Expected behavior
The query should be cancelled and return 4XX.
Additional Details
Plugins
Please list all plugins currently enabled.
Screenshots
If applicable, add screenshots to help explain your problem.
Host/Environment (please complete the following information):
- OS: [e.g. iOS]
- Version [e.g. 22]
Additional context
Add any other context about the problem here.