-
Notifications
You must be signed in to change notification settings - Fork 70
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
Fixed exception for case when Hybrid query being wrapped into bool query #490
Fixed exception for case when Hybrid query being wrapped into bool query #490
Conversation
ef57d1d
to
dff866d
Compare
Codecov ReportAttention:
Additional details and impacted files@@ Coverage Diff @@
## main #490 +/- ##
============================================
+ Coverage 84.37% 84.65% +0.27%
- Complexity 498 508 +10
============================================
Files 40 40
Lines 1491 1505 +14
Branches 228 234 +6
============================================
+ Hits 1258 1274 +16
+ Misses 133 128 -5
- Partials 100 103 +3 ☔ View full report in Codecov by Sentry. |
@martin-gaievski can you add the exception signature in the PR which we are getting? |
@martin-gaievski can you add what is the expected outcome with this change when a hybrid query is inside a bool query? |
@martin-gaievski the integration tests are also failing. If they are flaky lets fix them. |
I've updated PR header with the error response and server log entry |
Yes, sure, I've updated PR with a sample of expected response. Basically scores should be summarized based on Bool clauses. |
Ack, fixed the test. now it passes with the same seed:
|
a2c0593
to
438ae0a
Compare
@@ -7,6 +7,7 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/), | |||
### Features | |||
### Enhancements | |||
### Bug Fixes | |||
Fixed exception for case when Hybrid query being wrapped into bool query ([#490](https://github.com/opensearch-project/neural-search/pull/490) |
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.
Do we also have a task to not allow such queries in the future?
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.
Yes, this is the general plan, but there are cases when it's not that easy. For instance, when nested field is present in the index mapping then the query will be wrapped into the Bool query where hybrid will be one of the child clause. We're investigating possible options.
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.
@martin-gaievski can you link the github issue here?
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.
sure, this is a link to an issue #466
Signed-off-by: Martin Gaievski <gaievski@amazon.com>
Signed-off-by: Martin Gaievski <gaievski@amazon.com>
Signed-off-by: Martin Gaievski <gaievski@amazon.com>
8060635
to
f262695
Compare
b3c73bd
into
opensearch-project:main
The backport to
To backport manually, run these commands in your terminal: # Fetch latest updates from GitHub
git fetch
# Create a new working tree
git worktree add .worktrees/backport-2.x 2.x
# Navigate to the new working tree
cd .worktrees/backport-2.x
# Create a new branch
git switch --create backport/backport-490-to-2.x
# Cherry-pick the merged commit of this pull request and resolve the conflicts
git cherry-pick -x --mainline 1 b3c73bdaae28629d9be4128afcf549c790070887
# Push it to GitHub
git push --set-upstream origin backport/backport-490-to-2.x
# Go back to the original working tree
cd ../..
# Delete the working tree
git worktree remove .worktrees/backport-2.x Then, create a pull request where the |
…ery (opensearch-project#490) * Adding null check for case when hybrid query wrapped into bool query Signed-off-by: Martin Gaievski <gaievski@amazon.com> (cherry picked from commit b3c73bd)
…ery (opensearch-project#490) * Adding null check for case when hybrid query wrapped into bool query Signed-off-by: Martin Gaievski <gaievski@amazon.com> (cherry picked from commit b3c73bd) Signed-off-by: Martin Gaievski <gaievski@amazon.com>
…ery (opensearch-project#490) * Adding null check for case when hybrid query wrapped into bool query Signed-off-by: Martin Gaievski <gaievski@amazon.com> (cherry picked from commit b3c73bd) Signed-off-by: Martin Gaievski <gaievski@amazon.com>
…ery (opensearch-project#490) * Adding null check for case when hybrid query wrapped into bool query Signed-off-by: Martin Gaievski <gaievski@amazon.com> Signed-off-by: Gopala-Krishna.Char <gopala-krishna.char@intrafind.de>
…ery (opensearch-project#490) * Adding null check for case when hybrid query wrapped into bool query Signed-off-by: Martin Gaievski <gaievski@amazon.com> Signed-off-by: Gopala-Krishna.Char <gopala-krishna.char@intrafind.de>
* Handle case with nested list of objects Signed-off-by: Gopala-Krishna.Char <gopala-krishna.char@intrafind.de> * fix validateEmbeddingsFieldValues Method Signed-off-by: Gopala-Krishna.Char <gopala-krishna.char@intrafind.de> * spotless formatting Signed-off-by: Gopala-Krishna.Char <gopala-krishna.char@intrafind.de> * Onboard jenkins prod docker images on github actions (#483) Signed-off-by: Peter Zhu <zhujiaxi@amazon.com> Signed-off-by: Gopala-Krishna.Char <gopala-krishna.char@intrafind.de> * Update dependency org.json:json to v20231013 (#481) Co-authored-by: mend-for-github-com[bot] <50673670+mend-for-github-com[bot]@users.noreply.github.com> Signed-off-by: Gopala-Krishna.Char <gopala-krishna.char@intrafind.de> * [Backport main manually][bug fix] Fix async actions are left in neural_sparse query (#438) (#479) * [bug fix] Fix async actions are left in neural_sparse query (#438) * add serialization and deserialization Signed-off-by: zhichao-aws <zhichaog@amazon.com> * hash, equals. + UT Signed-off-by: zhichao-aws <zhichaog@amazon.com> * tidy Signed-off-by: zhichao-aws <zhichaog@amazon.com> * add test Signed-off-by: zhichao-aws <zhichaog@amazon.com> --------- Signed-off-by: zhichao-aws <zhichaog@amazon.com> (cherry picked from commit 51e6c00) * rm max_token_score Signed-off-by: zhichao-aws <zhichaog@amazon.com> * add changelog Signed-off-by: zhichao-aws <zhichaog@amazon.com> * tidy Signed-off-by: zhichao-aws <zhichaog@amazon.com> --------- Signed-off-by: zhichao-aws <zhichaog@amazon.com> Signed-off-by: Gopala-Krishna.Char <gopala-krishna.char@intrafind.de> * Fixed exception for case when Hybrid query being wrapped into bool query (#490) * Adding null check for case when hybrid query wrapped into bool query Signed-off-by: Martin Gaievski <gaievski@amazon.com> Signed-off-by: Gopala-Krishna.Char <gopala-krishna.char@intrafind.de> * Fixed Hybrid query for cases when it's wrapped into other compound queries (#498) * Fixed nested field case Signed-off-by: Martin Gaievski <gaievski@amazon.com> Signed-off-by: Gopala-Krishna.Char <gopala-krishna.char@intrafind.de> * Added the github action to copy the attached issues label to PR. (#504) Signed-off-by: Navneet Verma <navneev@amazon.com> Signed-off-by: Gopala-Krishna.Char <gopala-krishna.char@intrafind.de> * Added support for jdk-21 (#500) * Added support for jdk-21 Signed-off-by: Martin Gaievski <gaievski@amazon.com> Signed-off-by: Gopala-Krishna.Char <gopala-krishna.char@intrafind.de> * Add unit tests + small fixes Signed-off-by: krishy91 <crgkc.r@gmail.com> * fix indentation Signed-off-by: krishy91 <crgkc.r@gmail.com> * remove unused code + add 2nd level nesting test Signed-off-by: krishy91 <crgkc.r@gmail.com> * add integration test for list of nested objects Signed-off-by: krishy91 <crgkc.r@gmail.com> --------- Signed-off-by: Gopala-Krishna.Char <gopala-krishna.char@intrafind.de> Signed-off-by: Peter Zhu <zhujiaxi@amazon.com> Signed-off-by: zhichao-aws <zhichaog@amazon.com> Signed-off-by: Martin Gaievski <gaievski@amazon.com> Signed-off-by: Navneet Verma <navneev@amazon.com> Signed-off-by: krishy91 <crgkc.r@gmail.com> Co-authored-by: Gopala-Krishna.Char <gopala-krishna.char@intrafind.de> Co-authored-by: Peter Zhu <zhujiaxi@amazon.com> Co-authored-by: mend-for-github-com[bot] <50673670+mend-for-github-com[bot]@users.noreply.github.com> Co-authored-by: zhichao-aws <zhichaog@amazon.com> Co-authored-by: Martin Gaievski <gaievski@amazon.com> Co-authored-by: Navneet Verma <navneev@amazon.com>
* Handle case with nested list of objects Signed-off-by: Gopala-Krishna.Char <gopala-krishna.char@intrafind.de> * fix validateEmbeddingsFieldValues Method Signed-off-by: Gopala-Krishna.Char <gopala-krishna.char@intrafind.de> * spotless formatting Signed-off-by: Gopala-Krishna.Char <gopala-krishna.char@intrafind.de> * Onboard jenkins prod docker images on github actions (#483) Signed-off-by: Peter Zhu <zhujiaxi@amazon.com> Signed-off-by: Gopala-Krishna.Char <gopala-krishna.char@intrafind.de> * Update dependency org.json:json to v20231013 (#481) Co-authored-by: mend-for-github-com[bot] <50673670+mend-for-github-com[bot]@users.noreply.github.com> Signed-off-by: Gopala-Krishna.Char <gopala-krishna.char@intrafind.de> * [Backport main manually][bug fix] Fix async actions are left in neural_sparse query (#438) (#479) * [bug fix] Fix async actions are left in neural_sparse query (#438) * add serialization and deserialization Signed-off-by: zhichao-aws <zhichaog@amazon.com> * hash, equals. + UT Signed-off-by: zhichao-aws <zhichaog@amazon.com> * tidy Signed-off-by: zhichao-aws <zhichaog@amazon.com> * add test Signed-off-by: zhichao-aws <zhichaog@amazon.com> --------- Signed-off-by: zhichao-aws <zhichaog@amazon.com> (cherry picked from commit 51e6c00) * rm max_token_score Signed-off-by: zhichao-aws <zhichaog@amazon.com> * add changelog Signed-off-by: zhichao-aws <zhichaog@amazon.com> * tidy Signed-off-by: zhichao-aws <zhichaog@amazon.com> --------- Signed-off-by: zhichao-aws <zhichaog@amazon.com> Signed-off-by: Gopala-Krishna.Char <gopala-krishna.char@intrafind.de> * Fixed exception for case when Hybrid query being wrapped into bool query (#490) * Adding null check for case when hybrid query wrapped into bool query Signed-off-by: Martin Gaievski <gaievski@amazon.com> Signed-off-by: Gopala-Krishna.Char <gopala-krishna.char@intrafind.de> * Fixed Hybrid query for cases when it's wrapped into other compound queries (#498) * Fixed nested field case Signed-off-by: Martin Gaievski <gaievski@amazon.com> Signed-off-by: Gopala-Krishna.Char <gopala-krishna.char@intrafind.de> * Added the github action to copy the attached issues label to PR. (#504) Signed-off-by: Navneet Verma <navneev@amazon.com> Signed-off-by: Gopala-Krishna.Char <gopala-krishna.char@intrafind.de> * Added support for jdk-21 (#500) * Added support for jdk-21 Signed-off-by: Martin Gaievski <gaievski@amazon.com> Signed-off-by: Gopala-Krishna.Char <gopala-krishna.char@intrafind.de> * Add unit tests + small fixes Signed-off-by: krishy91 <crgkc.r@gmail.com> * fix indentation Signed-off-by: krishy91 <crgkc.r@gmail.com> * remove unused code + add 2nd level nesting test Signed-off-by: krishy91 <crgkc.r@gmail.com> * add integration test for list of nested objects Signed-off-by: krishy91 <crgkc.r@gmail.com> --------- Signed-off-by: Gopala-Krishna.Char <gopala-krishna.char@intrafind.de> Signed-off-by: Peter Zhu <zhujiaxi@amazon.com> Signed-off-by: zhichao-aws <zhichaog@amazon.com> Signed-off-by: Martin Gaievski <gaievski@amazon.com> Signed-off-by: Navneet Verma <navneev@amazon.com> Signed-off-by: krishy91 <crgkc.r@gmail.com> Co-authored-by: Gopala-Krishna.Char <gopala-krishna.char@intrafind.de> Co-authored-by: Peter Zhu <zhujiaxi@amazon.com> Co-authored-by: mend-for-github-com[bot] <50673670+mend-for-github-com[bot]@users.noreply.github.com> Co-authored-by: zhichao-aws <zhichaog@amazon.com> Co-authored-by: Martin Gaievski <gaievski@amazon.com> Co-authored-by: Navneet Verma <navneev@amazon.com> (cherry picked from commit ea49d3c)
* Handle case with nested list of objects Signed-off-by: Gopala-Krishna.Char <gopala-krishna.char@intrafind.de> * fix validateEmbeddingsFieldValues Method Signed-off-by: Gopala-Krishna.Char <gopala-krishna.char@intrafind.de> * spotless formatting Signed-off-by: Gopala-Krishna.Char <gopala-krishna.char@intrafind.de> * Onboard jenkins prod docker images on github actions (#483) Signed-off-by: Peter Zhu <zhujiaxi@amazon.com> Signed-off-by: Gopala-Krishna.Char <gopala-krishna.char@intrafind.de> * Update dependency org.json:json to v20231013 (#481) Co-authored-by: mend-for-github-com[bot] <50673670+mend-for-github-com[bot]@users.noreply.github.com> Signed-off-by: Gopala-Krishna.Char <gopala-krishna.char@intrafind.de> * [Backport main manually][bug fix] Fix async actions are left in neural_sparse query (#438) (#479) * [bug fix] Fix async actions are left in neural_sparse query (#438) * add serialization and deserialization Signed-off-by: zhichao-aws <zhichaog@amazon.com> * hash, equals. + UT Signed-off-by: zhichao-aws <zhichaog@amazon.com> * tidy Signed-off-by: zhichao-aws <zhichaog@amazon.com> * add test Signed-off-by: zhichao-aws <zhichaog@amazon.com> --------- Signed-off-by: zhichao-aws <zhichaog@amazon.com> (cherry picked from commit 51e6c00) * rm max_token_score Signed-off-by: zhichao-aws <zhichaog@amazon.com> * add changelog Signed-off-by: zhichao-aws <zhichaog@amazon.com> * tidy Signed-off-by: zhichao-aws <zhichaog@amazon.com> --------- Signed-off-by: zhichao-aws <zhichaog@amazon.com> Signed-off-by: Gopala-Krishna.Char <gopala-krishna.char@intrafind.de> * Fixed exception for case when Hybrid query being wrapped into bool query (#490) * Adding null check for case when hybrid query wrapped into bool query Signed-off-by: Martin Gaievski <gaievski@amazon.com> Signed-off-by: Gopala-Krishna.Char <gopala-krishna.char@intrafind.de> * Fixed Hybrid query for cases when it's wrapped into other compound queries (#498) * Fixed nested field case Signed-off-by: Martin Gaievski <gaievski@amazon.com> Signed-off-by: Gopala-Krishna.Char <gopala-krishna.char@intrafind.de> * Added the github action to copy the attached issues label to PR. (#504) Signed-off-by: Navneet Verma <navneev@amazon.com> Signed-off-by: Gopala-Krishna.Char <gopala-krishna.char@intrafind.de> * Added support for jdk-21 (#500) * Added support for jdk-21 Signed-off-by: Martin Gaievski <gaievski@amazon.com> Signed-off-by: Gopala-Krishna.Char <gopala-krishna.char@intrafind.de> * Add unit tests + small fixes Signed-off-by: krishy91 <crgkc.r@gmail.com> * fix indentation Signed-off-by: krishy91 <crgkc.r@gmail.com> * remove unused code + add 2nd level nesting test Signed-off-by: krishy91 <crgkc.r@gmail.com> * add integration test for list of nested objects Signed-off-by: krishy91 <crgkc.r@gmail.com> --------- Signed-off-by: Gopala-Krishna.Char <gopala-krishna.char@intrafind.de> Signed-off-by: Peter Zhu <zhujiaxi@amazon.com> Signed-off-by: zhichao-aws <zhichaog@amazon.com> Signed-off-by: Martin Gaievski <gaievski@amazon.com> Signed-off-by: Navneet Verma <navneev@amazon.com> Signed-off-by: krishy91 <crgkc.r@gmail.com> Co-authored-by: Gopala-Krishna.Char <gopala-krishna.char@intrafind.de> Co-authored-by: Peter Zhu <zhujiaxi@amazon.com> Co-authored-by: mend-for-github-com[bot] <50673670+mend-for-github-com[bot]@users.noreply.github.com> Co-authored-by: zhichao-aws <zhichaog@amazon.com> Co-authored-by: Martin Gaievski <gaievski@amazon.com> Co-authored-by: Navneet Verma <navneev@amazon.com> (cherry picked from commit ea49d3c) Co-authored-by: Gopala-Krishna Char <crgkc.r@gmail.com>
* Handle case with nested list of objects Signed-off-by: Gopala-Krishna.Char <gopala-krishna.char@intrafind.de> * fix validateEmbeddingsFieldValues Method Signed-off-by: Gopala-Krishna.Char <gopala-krishna.char@intrafind.de> * spotless formatting Signed-off-by: Gopala-Krishna.Char <gopala-krishna.char@intrafind.de> * Onboard jenkins prod docker images on github actions (opensearch-project#483) Signed-off-by: Peter Zhu <zhujiaxi@amazon.com> Signed-off-by: Gopala-Krishna.Char <gopala-krishna.char@intrafind.de> * Update dependency org.json:json to v20231013 (opensearch-project#481) Co-authored-by: mend-for-github-com[bot] <50673670+mend-for-github-com[bot]@users.noreply.github.com> Signed-off-by: Gopala-Krishna.Char <gopala-krishna.char@intrafind.de> * [Backport main manually][bug fix] Fix async actions are left in neural_sparse query (opensearch-project#438) (opensearch-project#479) * [bug fix] Fix async actions are left in neural_sparse query (opensearch-project#438) * add serialization and deserialization Signed-off-by: zhichao-aws <zhichaog@amazon.com> * hash, equals. + UT Signed-off-by: zhichao-aws <zhichaog@amazon.com> * tidy Signed-off-by: zhichao-aws <zhichaog@amazon.com> * add test Signed-off-by: zhichao-aws <zhichaog@amazon.com> --------- Signed-off-by: zhichao-aws <zhichaog@amazon.com> (cherry picked from commit 51e6c00) * rm max_token_score Signed-off-by: zhichao-aws <zhichaog@amazon.com> * add changelog Signed-off-by: zhichao-aws <zhichaog@amazon.com> * tidy Signed-off-by: zhichao-aws <zhichaog@amazon.com> --------- Signed-off-by: zhichao-aws <zhichaog@amazon.com> Signed-off-by: Gopala-Krishna.Char <gopala-krishna.char@intrafind.de> * Fixed exception for case when Hybrid query being wrapped into bool query (opensearch-project#490) * Adding null check for case when hybrid query wrapped into bool query Signed-off-by: Martin Gaievski <gaievski@amazon.com> Signed-off-by: Gopala-Krishna.Char <gopala-krishna.char@intrafind.de> * Fixed Hybrid query for cases when it's wrapped into other compound queries (opensearch-project#498) * Fixed nested field case Signed-off-by: Martin Gaievski <gaievski@amazon.com> Signed-off-by: Gopala-Krishna.Char <gopala-krishna.char@intrafind.de> * Added the github action to copy the attached issues label to PR. (opensearch-project#504) Signed-off-by: Navneet Verma <navneev@amazon.com> Signed-off-by: Gopala-Krishna.Char <gopala-krishna.char@intrafind.de> * Added support for jdk-21 (opensearch-project#500) * Added support for jdk-21 Signed-off-by: Martin Gaievski <gaievski@amazon.com> Signed-off-by: Gopala-Krishna.Char <gopala-krishna.char@intrafind.de> * Add unit tests + small fixes Signed-off-by: krishy91 <crgkc.r@gmail.com> * fix indentation Signed-off-by: krishy91 <crgkc.r@gmail.com> * remove unused code + add 2nd level nesting test Signed-off-by: krishy91 <crgkc.r@gmail.com> * add integration test for list of nested objects Signed-off-by: krishy91 <crgkc.r@gmail.com> --------- Signed-off-by: Gopala-Krishna.Char <gopala-krishna.char@intrafind.de> Signed-off-by: Peter Zhu <zhujiaxi@amazon.com> Signed-off-by: zhichao-aws <zhichaog@amazon.com> Signed-off-by: Martin Gaievski <gaievski@amazon.com> Signed-off-by: Navneet Verma <navneev@amazon.com> Signed-off-by: krishy91 <crgkc.r@gmail.com> Co-authored-by: Gopala-Krishna.Char <gopala-krishna.char@intrafind.de> Co-authored-by: Peter Zhu <zhujiaxi@amazon.com> Co-authored-by: mend-for-github-com[bot] <50673670+mend-for-github-com[bot]@users.noreply.github.com> Co-authored-by: zhichao-aws <zhichaog@amazon.com> Co-authored-by: Martin Gaievski <gaievski@amazon.com> Co-authored-by: Navneet Verma <navneev@amazon.com> Signed-off-by: yuye-aws <yuyezhu@amazon.com>
Description
There is a runtime NullPointer exception in case hybrid query is:
AND
It's not directly related to the fact that hybrid is wrapped into some other query. That case needs to be discussed separately, my current opinion is - we should not allow execution of such query, hybrid must be the top level query. This particular PR is focused on a runtime exception, and does not affect or lock us on a particular approach for a wrapped hybrid query case.
For instance if we send following search request:
Response looks something like one below:
this is what is the server logs:
Expected result is that we shouldn't have any exceptions, and individual scores are summarized based on the rules of wrapping Bool query. Below is example of how successful response may look like:
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.