0

I've got an Amazon ElasticSearch Service running and I can connect fine using a curl/postman, but when I try to create a elasticsearch-py instance my ide hangs indefinitely.

endpoints = ['http://XXX.us-east-1.es.amazonaws.com',
             'http://XXX.us-east-1.es.amazonaws.com:443',
             'http://XXX.us-east-1.es.amazonaws.com:9200']

for endpoint in endpoints:
    try:
        es = Elasticsearch(endpoint)
        print es.count('analytics_v4')
    except Exception, e:
        print e
        print endpoint + " didn't work"

This is my current test set up, my IDE (pycharm) completely stops at this point and I need to end the run to be able to try again, I've tried each endpoint individually and none of them work.

My access policy is :

{
  "Version": "2012-10-17",
  "Statement": [
    {
      "Effect": "Allow",
      "Principal": {
        "AWS": "*"
      },
      "Action": "es:*",
      "Resource": "arn:aws:es:us-east-1:MYIDdomain/analytics/*",
      "Condition": {
        "IpAddress": {
          "aws:SourceIp": [
            "MYIP"
          ]
        }
      }
    }
  ]
}

I'm getting an error for :433 of : ConnectionError(HTTPConnectionPool(host='MYID.us-east-1.es.amazonaws.com', port=443): Max retries exceeded with url: /analytics_v4/_count (Caused by <class 'httplib.BadStatusLine'>: '')) caused by: MaxRetryError(HTTPConnectionPool(host='MYID.us-east-1.es.amazonaws.com', port=443): Max retries exceeded with url: /analytics_v4/_count (Caused by <class 'httplib.BadStatusLine'>: ''))

2
  • Any reason you're passing a one element list to Elasticsearch([endpoint]) and not just the endpoint... Elasticsearch(endpoint) ? Commented Aug 14, 2017 at 15:35
  • @JonClements I was trying to stick to something like the solution found here: stackoverflow.com/questions/38528839/… Commented Aug 14, 2017 at 15:39

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.