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

Merged
merged 2 commits into from
Jan 24, 2025

Conversation

bugmakerrrrrr
Copy link
Contributor

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 field field1 with flat_object type and a doc with value {"field1": {"field2" : {"field3": "a"}}}, the inverted index under field1 field contains terms field1.field2 and field1.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 both lowerTerm and upperTerm are null.

Related Issues

Resolves #17069

Check List

  • Functionality includes testing.
  • API changes companion pull request created, if applicable.
  • Public documentation issue/PR created, if applicable.

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.

Copy link
Contributor

❌ 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]>
Copy link
Contributor

✅ Gradle check result for 98c36e0: SUCCESS

Copy link

codecov bot commented Jan 24, 2025

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 72.30%. Comparing base (931c1aa) to head (98c36e0).
Report is 1 commits behind head on main.

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.
📢 Have feedback on the report? Share it here.

@msfroh msfroh merged commit bc9e4d8 into opensearch-project:main Jan 24, 2025
33 of 34 checks passed
@bugmakerrrrrr
Copy link
Contributor Author

hi @msfroh , should we backport this to 2.x since it is a bug?

expani pushed a commit to expani/OpenSearch that referenced this pull request Jan 27, 2025
etolbakov pushed a commit to etolbakov/OpenSearch that referenced this pull request Jan 29, 2025
---------

Signed-off-by: panguixin <[email protected]>
Signed-off-by: Eugene Tolbakov <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[BUG] Flattened Field exists Query Issue with Dotted Sub-Field Names
2 participants