Hi, I am indexing text and vector in Elasticsearch, working on an use case where I am using cosineSimilarity to get the result. The query search is returning the list of documents with decreasing Confidence Scores with the most similar ones being at the top. For laptop query I am getting laptop/computer related document at top and other non laptop related document after that. Requirement for the use case is If user search by Laptop then the response would be laptop/computer/PC related document only, Not not laptop related document.
Query that I am using :
{
"query": {
"script_score": {
"query" : {
"match_all": {}
},
"script": {
"source": "cosineSimilarity(params.query_vector, 'vector') + 1.0",
"params": {
"query_vector": [vsctors]
}
}
}
}
}
Can someone please help on that.
Thanks.