Repository navigation
Conversation
Filters nested under must_not or should were hoisted to top-level fq, which inverted must_not and turned should alternatives into a conjunction. A nested bool under should was also spliced in without parentheses, so its required clauses became required for the whole query. Filters are now only hoisted under must, and a nested bool under should is grouped.
This branch has not been deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
convert-workloadtranslates OpenSearch search bodies withtranslate_to_solr_json_dsl. When aboolis nested inside anotherbool, it loses its scope in two ways.1. Nested filters are hoisted to
fqfrom anywhere.fq_listis passed down intomust_notandshouldclauses, so afilterdeep inside them becomes a top-level, requiredfq:2. A nested bool under
shouldis not grouped. Its clauses are joined straight into the should group, so its+clauses become required for the whole query:The converted workload then benchmarks a different query, often one that matches nothing or the wrong documents.
Fix: filters are only hoisted to
fqundermust, where they are required anyway. Undermust_notandshouldthey stay inline. A nested bool undershouldis wrapped in parentheses. The examples above now give-(+(status:deleted)),((+(color:red)) (+(color:blue)))and((+(a:1) +(b:2)) c:3). Hoisting undermustis unchanged.Tested: four tests in
test_workload_converter.py. Three fail on main, and the fourth checks that hoisting undermuststill works.ruff checkis clean and the full unit suite passes (1184 passed, 5 skipped).