gpt4 book ai didi

elasticsearch - 在索引上的Elasticsearch中调用_search API时出错

转载 作者:行者123 更新时间:2023-12-03 02:35:38 27 4
gpt4 key购买 nike

我正在使用botocore的AWSRequest来调用Elasticsearch集群。我正在通过_search API在索引上使用GET方法,如下所示:

req = AWSRequest(method=method, url=proto + host + urllib.parse.quote(path), data=payload,
headers={'Host': host, 'Content-Type': 'application/json'})

路径采用以下格式:
/<Document-Index>/_search?q=param:param-val

我在用:
SigV4Auth(creds, 'es', region).add_auth(req)
http_session = URLLib3Session()
res = http_session.send(req.prepare())

进行对 Elasticsearch 端点的GET调用。
我收到错误提示:
Incorrect HTTP method for uri [/<Document-Index>/_search?<query_terms>] and method [GET], allowed: [POST]",
status: 405

谁能帮我这个?

谢谢

最佳答案

我认为您的请求网址不正确,请在某处打印并检查。当请求url为-GET test_index而不是Kibana的GET test_index/_search时,我观察到完全相同的错误。

关于elasticsearch - 在索引上的Elasticsearch中调用_search API时出错,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/58961766/

27 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com