简体   繁体   中英

error using Python Elasticserarch-py package

So I am trying to create a connection to AWS ES. I have successfully connected to my S3 bucket in the same zone. However, when I try to connect to ES, I get this message every time.

Please install requests to use RequestsHttpConnection.

I have imported the correct module but nothing seems to fix this issue. Here is my code

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)

This looks the same as every example I can find but for some reason it will not connect.

This is with Python 3.5 and my dev environment is VS 2015.

As per the documentation for elasticsearch-py .

Note that the RequestsHttpConnection requires requests to be installed.

There is a need to explictly install the requests module if it does not already exist in the PYTHONPATH

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM