-
Notifications
You must be signed in to change notification settings - Fork 1.9k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Fix exists query for flat object #17108
Conversation
Signed-off-by: panguixin <[email protected]>
❌ Gradle check result for 354123c: FAILURE Please examine the workflow log, locate, and copy-paste the failure(s) below, then iterate to green. Is the failure a flaky test unrelated to your change? |
Signed-off-by: panguixin <[email protected]>
Codecov ReportAll modified and coverable lines are covered by tests ✅
Additional details and impacted files@@ Coverage Diff @@
## main #17108 +/- ##
============================================
- Coverage 72.30% 72.30% -0.01%
+ Complexity 65482 65437 -45
============================================
Files 5309 5309
Lines 304324 304323 -1
Branches 44132 44132
============================================
- Hits 220056 220038 -18
+ Misses 66259 66222 -37
- Partials 18009 18063 +54 ☔ View full report in Codecov by Sentry. |
hi @msfroh , should we backport this to 2.x since it is a bug? |
--------- Signed-off-by: panguixin <[email protected]> Signed-off-by: expani <[email protected]>
--------- Signed-off-by: panguixin <[email protected]> Signed-off-by: Eugene Tolbakov <[email protected]>
Description
The current implementation of exists query for subfield uses an inverted index under
<field name>
to perform the query, this inverted index create mapping for each level of subfields. Taking a fieldfield1
withflat_object
type and a doc with value{"field1": {"field2" : {"field3": "a"}}}
, the inverted index underfield1
field contains termsfield1.field2
andfield1.field3
, when we run the query{"query": {"exists": {"field": "field1.field2.field3"}}}
, it turns into term query"field1": "field1.field2.field3"
, there is no match term obviously.Since
PathAndValue
field contains<full path>=<value>
term or doc values, we can use the user specified field name append=
symbol as prefix to run the query, which equals to range query with bothlowerTerm
andupperTerm
arenull
.Related Issues
Resolves #17069
Check List
By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license.
For more information on following Developer Certificate of Origin and signing off your commits, please check here.