Closed sarita05 closed 3 years ago
At the moment, the knn does not support multiple fields during query: https://github.com/opendistro-for-elasticsearch/k-NN/blob/3cbcc9fb1fb6cf24bb387f39805ecab992cde927/src/main/java/com/amazon/opendistroforelasticsearch/knn/index/KNNQueryBuilder.java#L120.
So the following query will not work:
POST /myindex/_search
{
"size" : 10,
"query": {
"knn": {
"my_vector_1": {
"vector": [128, 128],
"k": 2
},
"my_vector_2": {
"vector": [128, 128],
"k": 2
}
}
}
}
If this is needed for your use case, we can treat this as a feature request.
I am unable to get any example to define multiple fields in query. How we can define multiple fields ((not one as shown in this example) and how it does work internally? Please help me out. https://opendistro.github.io/for-elasticsearch-docs/docs/knn/
GET my-index/_search { "size": 2, "query": { "knn": { "my_vector2": { "vector": [2, 3, 5, 6], "k": 2 } } } }