elasticsearch.BadRequestError:BadRequestError(400,'parsing_exception','未知查询[查询]')

问题描述 投票:0回答:1

具体错误回溯如下:

这是我当前的Python代码:

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)

我做错了什么?

python elasticsearch
1个回答
0
投票

尝试将 query 替换为 body

res = es.search(index=index_name, body=query)

© www.soinside.com 2019 - 2024. All rights reserved.