When I searched for similarity again, I found the following problem. I matched the content with the highest similarity displayed by es's vector cosine similarity. I manually compared the question vector with the vector of the content with the highest similarity retrieved by es, and the question vector with the vector of the content that I thought should have the highest similarity. I found that the vector I thought was higher was indeed more similar.
dense_vector_query = {
"size": top_k,
"query": {
"script_score": {
"query": {
"match_all": {}
},
"script": {
"source": "cosineSimilarity(params.query_vector, 'embedding') + 1.0",
"params": {
"query_vector": embeddings
}
}
}
}
}