-
Notifications
You must be signed in to change notification settings - Fork 25.6k
Closed
Labels
:Search Relevance/VectorsVector searchVector search>enhancementTeam:Search RelevanceMeta label for the Search Relevance team in ElasticsearchMeta label for the Search Relevance team in Elasticsearch
Description
It's useful to be able to combine kNN with a filter ("find the nearest documents that also satisfy this search query"). We could extend the recently added _knn_search endpoint to accept search filters too:
POST index/_knn_search
{
"knn": {
"field": "image_vector",
"query_vector": [0.3f, 0.1f, ...],
"k": 10,
"num_candidates": 100
},
"filter": {
"term": {
"file_type": "jpeg"
}
}
}
The filter section accepts a search filter, defined through the Query DSL. The response will contain the nearest k documents that also match the filter. We could extend the filter section to accept a list of filters if this proves helpful.
heipei, and-kul, Jacse, mayya-sharipova, SGINJ and 5 moreand-kul and yanchaoguojoshdevins, SGINJ, ingo-m and yanchaoguo
Metadata
Metadata
Assignees
Labels
:Search Relevance/VectorsVector searchVector search>enhancementTeam:Search RelevanceMeta label for the Search Relevance team in ElasticsearchMeta label for the Search Relevance team in Elasticsearch