Combine knn score and match score

hi,
my index has one knn vector field and one text field. I would like to create a search query which score would combile a score of KNN vector(cosinemil) and match score . Also I would like to boost KNN score so it can outweight the match score. Is it possible?
many thanks

Hi!!
Maybe this doc can you help.

You can use functions to get the score from the vector and combine the scores through boost_mode.

Are your vectors indexed ("index" : true), and you use _knn_search API? If yes, currently there is no way to combine scores from a match query and knn search on the Elasticsearch side. You need to do it on your application level. But we are actively working on this functionality, and the progress can be tracked here.

If your vectors are not indexed, you can use script_score query where you can combine cosineSimilarity with a _score from a match query through a script in any way you like.

This topic was automatically closed 28 days after the last reply. New replies are no longer allowed.