python - 使用 Python Elasticserarch-py 包时出错

标签 python amazon-web-services elasticsearch amazon-elasticsearch

所以我正在尝试创建与 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/

相关文章:

Python模拟paramiko sftpclient打开

python - 用numpy中的另一个小矩阵替换矩阵的子部分

python - 如何在 C 和 Python 中从字节中提取 LSB?

python - scrapy的Request函数没有被调用

ruby-on-rails - Tire + Elasticsearch:如何搜索值范围?

elasticsearch - 查询OR条件

node.js - Azure DevOp - 指定已弃用的运行时 (nodejs12.x)

python - SSL:在 AWS EC2 上运行的 Python 代码出现 CERTIFICATE_VERIFY_FAILED 错误

amazon-web-services - 无法再连接到 AWS Windows 或 Linux 实例

amazon-web-services - AWS Elasticsearch Service 的 Fluentd 安装说明