Do not create Weights concurrently in ES|QL lucene operator #109907
Merged
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There is currently an optimisation to execute create lucene weights in the worker threads if the weight only applies to one segment. While theoretically that might work it seems to make the code more difficult to reason about because the execution pattern differs from what the classical search is doing and it creates some differences in the benchmarks.
In particular this execution patterns seems to create contention on the LRU cache in some situations. This commit proposes to remove this optimisation to bring search and esql with the same query execution path. We can think later if this optimisation is really worthy and bring it to both code paths. At the moment, it seems this is causing more issues in the nightly benchmarks.