Reputation: 3099
I'm trying to use the ElasticSearch Python wrapper on Heroku. I have used the Bonsai Heroku add-on, and have received a URL that looks like the one given in the documentation, http://ql9lsrn8:[email protected]/. My question is, how do I connect to this instance using the ElasticSearch Python wrapper?
The documentation (elasticsearch-py.readthedocs.org/en/latest/api.html#elasticsearch) gives the following example:
es = Elasticsearch([
{'host': 'localhost'},
{'host': 'othernode', 'port': 443, 'url_prefix': 'es', 'use_ssl': True},
])
Can anyone tell me what values I should use for the host, port and url_prefix?
Upvotes: 3
Views: 615
Reputation: 6206
the url heroku gives you has the form of
http://username:password@host:port/
so you can obtain this information:
host: redwood-94865.us-east-1.bonsai.io
port: 80 (implicit)
user_ssl: False (because protocol of that url is http, not https)
username: ql9lsrn8
password: img5ndnsbtaahloy
You can learn about this notation on Wikipedia.
Upvotes: 4