Hello,
script gives you flexibility to combine textual scores with any other computations the way you like.
For example, the following query uses a linear combination of BM25 score from query: message:elasticsearch with a vector cosine similarity.
{
"query": {
"script_score": {
"query": {
"match": {
"message": "elasticsearch"
}
},
"script": {
"source": "_score + cosineSimilarity(params.query_vector, 'my_dense_vector')",
"params": {
"query_vector": [4, 3.4,-0.2]
}
}
}
}
}