所以我正在尝试创建与 AWS ES 的连接。我已成功连接到同一区域中的 S3 存储桶。但是,当我尝试连接到 ES 时,每次都会收到此消息。
Please install requests to use RequestsHttpConnection.
我已经导入了正确的模块,但似乎没有什么可以解决这个问题。这是我的代码
import elasticsearch
from elasticsearch import Elasticsearch, RequestsHttpConnection
from boto3 import client, logging, s3, Session
host = 'search-esdomain-t3rfr4trerdgfdh6t4t43ef.us-east-1.es.amazonaws.com'
es = Elasticsearch(
hosts = host,
connection_class = RequestsHttpConnection,
http_auth = ('user', 'password'),
use_ssl = True,
verify_certs = False)
这看起来与我能找到的每个示例相同,但由于某种原因它无法连接。
这是使用 Python 3.5,我的开发环境是 VS 2015。
最佳答案
根据 elasticsearch-py 的文档.
Note that the RequestsHttpConnection requires requests to be installed.
需要显式安装requests模块(如果 PYTHONPATH
关于python - 使用 Python Elasticserarch-py 包时出错,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/39458810/