-
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
Description
By reading some of the latest bugfixes in 8.13.0 and the documentation it seems it is still not possible to pre-filter a knn search on nested mappings, such as:
{
"mappings":{
"properties":{
"title":{
"type":"keyword"
},
"paragraphs":{
"type":"nested",
"properties":{
"language":{
"type":"keyword"
},
"vector":{
"type":"dense_vector",
"dims":3,
"similarity":"cosine",
"index":true
}
}
}
}
}
}
then searching the following would never match any document:
{
"query":{
"nested":{
"path":"paragraphs",
"query":{
"knn":{
"field":"paragraphs.vector",
"query_vector":[
0.5,
0.5,
0.5
],
"num_candidates":5,
"filter":{
"bool":{
"must":[
{
"match":{
"paragraphs.language":"EN"
}
}
]
}
}
}
}
}
}
}
or
{
"query":{
"nested":{
"path":"paragraphs",
"query":{
"knn":{
"field":"paragraphs.vector",
"query_vector":[
0.5,
0.5,
0.5
],
"num_candidates":5,
"filter":{
"nested":{
"path":"paragraphs",
"query":{
"bool":{
"must":[
{
"match":{
"paragraphs.language":"EN"
}
}
]
}
}
}
}
}
}
}
}
}
In the current implementation the filter scope is limited to the parent document, thus limiting other functionalities of nested documents.
I wonder how hard it would be to extend the filter context to nested documents?
Thank you!
ppaanngggg, mpaluch92, henningn97, thorbengoldbecker, bmokbel-visionai and 18 morehenningn97, mpaluch92, bmokbel-visionai, teodorgeorgiev-visionai, FabianMrk7 and 7 more
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