-
Notifications
You must be signed in to change notification settings - Fork 72
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
Add filter option for query type #88
Conversation
Adds filter option for query type. Filtering support was introduced in the k-NN plugin in 2.4. Breaks backwards compatibility with OpenSearch 2.4, however, given that 2.4 is experimental, this is okay. Backwards compatibility issues will only arise during mixed cluster upgrade. Signed-off-by: John Mazanec <[email protected]>
@SuppressWarnings("unchecked") | ||
protected int getHitCount(Map<String, Object> searchResponseAsMap) { | ||
Map<String, Object> hits1map = (Map<String, Object>) searchResponseAsMap.get("hits"); | ||
List<Object> hits2List = (List<Object>) hits1map.get("hits"); |
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.
Shouldn't that var be hits1List
?
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.
good point, will update.
@@ -52,6 +62,8 @@ public class NeuralQueryBuilderTests extends OpenSearchTestCase { | |||
private static final String QUERY_NAME = "queryName"; | |||
private static final Supplier<float[]> TEST_VECTOR_SUPPLIER = () -> new float[10]; | |||
|
|||
private static final QueryBuilder TEST_FILTER = new MatchAllQueryBuilder(); |
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.
nice query, I missed it when writing filtering for knn
Question: |
Hi @navneet1v could you give an example of what you mean by out of neural clause? |
Signed-off-by: John Mazanec <[email protected]>
For a case like this, what will happen:
|
@navneet1v Ah I see for the boolean clause. In this case, no results would be returned. The neural query would only return results with:
However, after this is returned in bool clause, the bool filter would be run after this, selecting only from:
|
Adds filter option for query type. Filtering support was introduced in the k-NN plugin in 2.4. Breaks backwards compatibility with OpenSearch 2.4, however, given that 2.4 is experimental, this is okay. Backwards compatibility issues will only arise during mixed cluster upgrade. Signed-off-by: John Mazanec <[email protected]> (cherry picked from commit de551e2)
Description
Adds filter option for query type. Filtering support was introduced in the k-NN plugin in 2.4. This change breaks backwards compatibility with OpenSearch 2.4, however, given that 2.4 is experimental, this is okay. Backwards
compatibility issues will only arise during mixed cluster upgrade.
Query will look like:
Issues Resolved
#86
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.