-
Notifications
You must be signed in to change notification settings - Fork 123
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
[BUG] Filter on Parent Doc fields inside Nested knn query fails for many Query types #2222
Labels
bug
Something isn't working
Comments
Although this issue might have to resolved directly on NestedHelper, I wanted to know the others opinion on this issue and how to go about it. It affects the knn search & hence the Neural Search (for nested documents) directly. |
@heemin32 could you take a look at this? |
I am also finding that Create index
Index documents
Query using
Should exclude id 1 but it does not. |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
What is the bug?
When a document contains vectors in nested documents, and we perform a nested knn query with filters set on the parent documents fields, the filters can only be specific Query types (like TermQuery). If for example a Phrase Query is specified as a filter, the knn query fails to retrieve any results at all. There are several other Query types (like exists, range etc) which also fail.
How can one reproduce the bug?
Steps to reproduce the behavior:
What is the expected behavior?
Evene when filters specify PhraseQuery or range query etc. the filters should be applied & results should be returned if any.
What is your host/environment?
Do you have any additional context?
On analysis, we found that @navneet1v added the functionality to support applying filters on parent documents here: #1356
The code uses the NestedHelper.mightMatchNestedDocs method determine whether to filter is applied on Parent doucment or nested document. Unfortunately, mightMatchNestedDocs method checks for speicifc Query types individually to see if they contain "field" & check if it is present in the parent or the nested doc. This list of Query types in not complete. Many commonly uses Query types which have "field" are missing like Phrase query, Range query etc.
https://github.com/opensearch-project/OpenSearch/blob/f1c98a4da0cf6583212eecc9ed8ebc3cd426a918/server/src/main/java/org/opensearch/index/search/NestedHelper.java#L65
The text was updated successfully, but these errors were encountered: