def get_es(**overrides): """Monkey patch elasticutils get_es to add use_ssl and http_auth settings.""" from django.conf import settings defaults = { 'urls': settings.ES_URLS, 'timeout': getattr(settings, 'ES_TIMEOUT', 5), 'use_ssl': getattr(settings, 'ES_USE_SSL', False), 'http_auth': getattr(settings, 'ES_HTTP_AUTH', None), 'verify_certs': getattr(settings, 'ES_VERIFY_CERTS', True), } defaults.update(overrides) return base_get_es(**defaults)
def get_es(**overrides): """Monkey patch elasticutils get_es to add use_ssl and http_auth settings.""" from django.conf import settings from elasticsearch import RequestsHttpConnection defaults = { "urls": settings.ES_URLS, "timeout": getattr(settings, "ES_TIMEOUT", 5), "use_ssl": getattr(settings, "ES_USE_SSL", False), "http_auth": getattr(settings, "ES_HTTP_AUTH", None), "verify_certs": getattr(settings, "ES_VERIFY_CERTS", True), "connection_class": RequestsHttpConnection, } defaults.update(overrides) return base_get_es(**defaults)
def get_es(**overrides): """Return a elasticsearch Elasticsearch object using settings from ``settings.py``. :arg overrides: Allows you to override defaults to create the ElasticSearch object. You can override any of the arguments isted in :py:func:`elasticutils.get_es`. For example, if you wanted to create an ElasticSearch with a longer timeout to a different cluster, you'd do: >>> from elasticutils.contrib.django import get_es >>> es = get_es(urls=['http://some_other_cluster:9200'], timeout=30) """ defaults = {"urls": settings.ES_URLS, "timeout": getattr(settings, "ES_TIMEOUT", 5)} defaults.update(overrides) return base_get_es(**defaults)
def get_es(**overrides): """Return a elasticsearch Elasticsearch object using settings from ``settings.py``. :arg overrides: Allows you to override defaults to create the ElasticSearch object. You can override any of the arguments isted in :py:func:`elasticutils.get_es`. For example, if you wanted to create an ElasticSearch with a longer timeout to a different cluster, you'd do: >>> from elasticutils.contrib.django import get_es >>> es = get_es(urls=['http://some_other_cluster:9200'], timeout=30) """ defaults = { 'urls': settings.ES_OLD_URLS, 'timeout': getattr(settings, 'ES_OLD_TIMEOUT', 5) } defaults.update(overrides) return base_get_es(**defaults)