maltman
maltman

Reputation: 454

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.

Upvotes: 2

Views: 3745

Answers (1)

keety
keety

Reputation: 17461

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

Upvotes: 4

Related Questions