ElasticSearch _find 方法获取返回的保存对象"not handler found for URI [/s/<space>/api/saved_objects/_find...] and method [GET]"
ElasticSearch _find method to get saved objects returning "not handler found for URI [/s/<space>/api/saved_objects/_find...] and method [GET]"
我正在 Python 中尝试在 Kibana 的 space 中检索保存的搜索。
我正在尝试按照 https://www.elastic.co/guide/en/kibana/current/saved-objects-api-find.html
中的示例进行操作
这是我的代码。
r = requests.get('http://myhost.com:9200/s/guy-levin/api/saved_objects/_find?type=search',
auth=(username, password))
print(r.status_code)
print(r.text)
print(r.json())
我得到输出:
400
{"error":"no handler found for uri [/s/guy-levin/api/saved_objects/_find?type=search] and method [GET]"}
{'error': 'no handler found for uri [/s/guy-levin/api/saved_objects/_find?type=search] and method [GET]'}
我也试过es.search()
,但如果我试了es.search(doc_type='search')
[甚至不确定这是否正确; Internet 搜索到目前为止没有帮助],我得到一个以以下结尾的堆栈跟踪:
elasticsearch.exceptions.AuthorizationException: AuthorizationException(403, 'security_exception', 'action [indices:data/read/search] is unauthorized for user [some_user_name]')
将端口更改为 5601,我得到了这个堆栈跟踪:
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "C:/git/KibanaReader/main.py", line 207, in <module>
get_saved_search('Blah Blah REST API')
File "C:/git/KibanaReader/main.py", line 90, in get_saved_search
r = requests.get('http://kbqa2.nayax.com:5601/s/guy-levin/api/saved_objects/_find?type=search',
File "C:\git\KibanaReader\venv\lib\site-packages\requests\api.py", line 75, in get
return request('get', url, params=params, **kwargs)
File "C:\git\KibanaReader\venv\lib\site-packages\requests\api.py", line 61, in request
return session.request(method=method, url=url, **kwargs)
File "C:\git\KibanaReader\venv\lib\site-packages\requests\sessions.py", line 542, in request
resp = self.send(prep, **send_kwargs)
File "C:\git\KibanaReader\venv\lib\site-packages\requests\sessions.py", line 655, in send
r = adapter.send(request, **kwargs)
File "C:\git\KibanaReader\venv\lib\site-packages\requests\adapters.py", line 498, in send
raise ConnectionError(err, request=request)
requests.exceptions.ConnectionError: ('Connection aborted.', RemoteDisconnected('Remote end closed connection without response'))
保存的对象 API 是一个 Kibana API,因此您需要将 Kibana 端点(默认端口 5601)作为目标,而不是 Elasticsearch 端点(默认端口 9200)。
右边的URL应该是
http://myhost.com:5601/s/guy-levin/api/saved_objects/_find?type=search
^
|
change this
我正在 Python 中尝试在 Kibana 的 space 中检索保存的搜索。
我正在尝试按照 https://www.elastic.co/guide/en/kibana/current/saved-objects-api-find.html
中的示例进行操作这是我的代码。
r = requests.get('http://myhost.com:9200/s/guy-levin/api/saved_objects/_find?type=search',
auth=(username, password))
print(r.status_code)
print(r.text)
print(r.json())
我得到输出:
400
{"error":"no handler found for uri [/s/guy-levin/api/saved_objects/_find?type=search] and method [GET]"}
{'error': 'no handler found for uri [/s/guy-levin/api/saved_objects/_find?type=search] and method [GET]'}
我也试过es.search()
,但如果我试了es.search(doc_type='search')
[甚至不确定这是否正确; Internet 搜索到目前为止没有帮助],我得到一个以以下结尾的堆栈跟踪:
elasticsearch.exceptions.AuthorizationException: AuthorizationException(403, 'security_exception', 'action [indices:data/read/search] is unauthorized for user [some_user_name]')
将端口更改为 5601,我得到了这个堆栈跟踪:
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "C:/git/KibanaReader/main.py", line 207, in <module>
get_saved_search('Blah Blah REST API')
File "C:/git/KibanaReader/main.py", line 90, in get_saved_search
r = requests.get('http://kbqa2.nayax.com:5601/s/guy-levin/api/saved_objects/_find?type=search',
File "C:\git\KibanaReader\venv\lib\site-packages\requests\api.py", line 75, in get
return request('get', url, params=params, **kwargs)
File "C:\git\KibanaReader\venv\lib\site-packages\requests\api.py", line 61, in request
return session.request(method=method, url=url, **kwargs)
File "C:\git\KibanaReader\venv\lib\site-packages\requests\sessions.py", line 542, in request
resp = self.send(prep, **send_kwargs)
File "C:\git\KibanaReader\venv\lib\site-packages\requests\sessions.py", line 655, in send
r = adapter.send(request, **kwargs)
File "C:\git\KibanaReader\venv\lib\site-packages\requests\adapters.py", line 498, in send
raise ConnectionError(err, request=request)
requests.exceptions.ConnectionError: ('Connection aborted.', RemoteDisconnected('Remote end closed connection without response'))
保存的对象 API 是一个 Kibana API,因此您需要将 Kibana 端点(默认端口 5601)作为目标,而不是 Elasticsearch 端点(默认端口 9200)。
右边的URL应该是
http://myhost.com:5601/s/guy-levin/api/saved_objects/_find?type=search
^
|
change this