Permalink
Browse files

elasticsearch: make it work with https and fix some of the options

  • Loading branch information...
Corentin Chary authored and iksaif committed Jul 11, 2018
1 parent 33f863b commit b4cb8ed610ad0bd3edcc65bbffec2829a70549a9
Showing with 18 additions and 8 deletions.
  1. +16 −8 biggraphite/drivers/elasticsearch.py
  2. +2 −0 requirements.txt
@@ -130,7 +130,8 @@
OPTIONS = {
"username": str,
"password": str,
"keyspace": str,
"index": str,
"index_suffix": str,
"hosts": _utils.list_from_str,
"port": int,
"timeout": float,
@@ -350,15 +351,22 @@ def _connect(self):
http_auth = (self._username, self._password or "")
else:
http_auth = None
kwargs = {
'sniff_on_start': True,
'sniff_on_connection_fail': True,
'retry_on_timeout': True,
'max_retries': 3,
'timeout': self._timeout,
}
if self._port:
kwargs['port'] = self._port
if http_auth:
kwargs['http_auth'] = http_auth
es = elasticsearch.Elasticsearch(
self._hosts,
port=self._port,
http_auth=http_auth,
sniff_on_start=True,
sniff_on_connection_fail=True,
retry_on_timeout=True,
max_retries=3,
timeout=self._timeout,
**kwargs
)
log.info("Connected: %s" % es.info())
@@ -15,6 +15,8 @@ scales
# ElasticSearch
elasticsearch
elasticsearch-dsl
# To support https
certifi
# Core
six

0 comments on commit b4cb8ed

Please sign in to comment.