The specific error traceback is as follows:
Here is my current Python code:
top_k=3
query = {
"query": {
"script_score": {
"query": {
"match_all": {}
},
"script": {
"source": "cosineSimilarity(params.query_vector, 'ask_vector') + 1.0",
"lang": "painless",
"params": {
"query_vector": query_embedding.tolist()
}
}
}
},
"size": top_k
}
res = es.search(index=index_name, query=query)
What am I doing wrong?
try replace query to body.
res = es.search(index=index_name, body=query)