Skip to content
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

Merged
merged 8 commits into from
Feb 11, 2022
Merged

Conversation

cmark
Copy link
Member

@cmark cmark commented Feb 11, 2022

This PR optimizes bool index queries to reduce (and hopefully eliminate) the chance of hitting search errors:

  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.

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`.
@cmark cmark requested a review from apeteri February 11, 2022 13:49
@cmark cmark self-assigned this Feb 11, 2022
@codecov-commenter
Copy link

Codecov Report

Merging #976 (8d679a1) into 8.x (761fbd9) will increase coverage by 0.02%.
The diff coverage is 78.09%.

Impacted file tree graph

@@             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     
Impacted Files Coverage Δ
...m/b2international/index/es/EsDocumentSearcher.java 80.39% <0.00%> (-0.64%) ⬇️
...om/b2international/index/query/BoolExpression.java 34.78% <0.00%> (+0.69%) ⬆️
...c/com/b2international/index/query/Expressions.java 69.76% <29.41%> (-9.95%) ⬇️
...tional/index/revision/DefaultRevisionSearcher.java 67.64% <75.00%> (+4.01%) ⬆️
...ational/index/query/AbstractExpressionBuilder.java 93.33% <91.89%> (-6.67%) ⬇️
...b2international/index/es/query/EsQueryBuilder.java 82.48% <100.00%> (-0.40%) ⬇️
...dex/src/com/b2international/index/query/Query.java 79.16% <100.00%> (+1.55%) ⬆️
.../b2international/index/es/client/EsClientBase.java 64.77% <0.00%> (-1.14%) ⬇️
.../snomed/core/ecl/SnomedEclRefinementEvaluator.java 85.94% <0.00%> (+0.27%) ⬆️
... and 5 more

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 761fbd9...8d679a1. Read the comment docs.

...Sets.intersection when collapsing term filters
Copy link
Member

@apeteri apeteri left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM!

@cmark cmark merged commit da5e13f into 8.x Feb 11, 2022
@cmark cmark deleted the issue/SO-4080-flatten-bool-queries branch February 11, 2022 16:03
# for free to join this conversation on GitHub. Already have an account? # to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants