-
Notifications
You must be signed in to change notification settings - Fork 33
New issue
Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? # to your account
SO-4080: optimize bool index queries #976
Conversation
1. merge term filters specified on the same field to reduce the number of bool query clauses 2. flatten deep bool query hierarchies to reduce the chance of getting HTTP 400 error due to `indices.query.bool.max_nested_depth` setting, which defaults to depth of `20`.
...an HTTP 400 error
commons/com.b2international.index/src/com/b2international/index/es/EsDocumentSearcher.java
Show resolved
Hide resolved
...com.b2international.index/src/com/b2international/index/query/AbstractExpressionBuilder.java
Show resolved
Hide resolved
...com.b2international.index/src/com/b2international/index/query/AbstractExpressionBuilder.java
Outdated
Show resolved
Hide resolved
...com.b2international.index/src/com/b2international/index/query/AbstractExpressionBuilder.java
Show resolved
Hide resolved
...instead of always using must (which is mainly for scoring)
They cause the resulting boolean logic to change from and to or, which leads to incorrect results.
...by using the intersection of the specified values
Codecov Report
@@ Coverage Diff @@
## 8.x #976 +/- ##
============================================
+ Coverage 64.57% 64.60% +0.02%
- Complexity 11824 11876 +52
============================================
Files 1689 1689
Lines 55470 55548 +78
Branches 5120 5152 +32
============================================
+ Hits 35821 35887 +66
- Misses 17460 17467 +7
- Partials 2189 2194 +5
Continue to review full report at Codecov.
|
...Sets.intersection when collapsing term filters
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM!
This PR optimizes bool index queries to reduce (and hopefully eliminate) the chance of hitting search errors:
indices.query.bool.max_nested_depth
setting, which defaults to depth of20
.