-
Notifications
You must be signed in to change notification settings - Fork 127
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
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. |
I opened this ticket #2339 that was closed as a duplicate of this ticket, however I wanted to note that I am seeing the issue with range filters on non-nested vector fields. Specifically, I am seeing no hits when using a knn query range filter for a date field. |
Hi @kristib. I think I closed the issue to quickly. Your issue might not be a duplication of this issue as your case is not with nested field. Let me reopen it. Thanks! |
@buddharajusahil will look into this. |
Please assign this issue to me |
Hi @krishy91 do you mind including the exact commands used to reproduce this bug? Just want to make sure I am reproducing one to one. |
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: