diff --git a/pod/main/configuration.json b/pod/main/configuration.json index c5f646b417..98a9efbd23 100644 --- a/pod/main/configuration.json +++ b/pod/main/configuration.json @@ -3122,6 +3122,20 @@ }, "pod_version_end": "", "pod_version_init": "3.1.0" + }, + "ES_OPTIONS": { + "default_value": {}, + "description": { + "en": [ + "" + ], + "fr": [ + "Options d’ElasticSearch, notamment utilisées pour ES8 en SSL et avec un user en paramètre", + "Voir [https://www.elastic.co/guide/en/elasticsearch/client/python-api/current/config.html]() pour plus d'informations." + ] + }, + "pod_version_end": "", + "pod_version_init": "3.1.0" } }, "title": { @@ -5069,4 +5083,4 @@ } } } -] \ No newline at end of file +] diff --git a/pod/video_search/utils.py b/pod/video_search/utils.py index 15755af20b..916aca0dc1 100644 --- a/pod/video_search/utils.py +++ b/pod/video_search/utils.py @@ -15,6 +15,7 @@ ES_TIMEOUT = getattr(settings, "ES_TIMEOUT", 30) ES_MAX_RETRIES = getattr(settings, "ES_MAX_RETRIES", 10) ES_VERSION = getattr(settings, "ES_VERSION", 6) +ES_OPTIONS = getattr(settings, "ES_OPTIONS", {}) def index_es(video): @@ -24,6 +25,7 @@ def index_es(video): timeout=ES_TIMEOUT, max_retries=ES_MAX_RETRIES, retry_on_timeout=True, + **ES_OPTIONS, ) if es.ping(): try: @@ -57,6 +59,7 @@ def delete_es(video): timeout=ES_TIMEOUT, max_retries=ES_MAX_RETRIES, retry_on_timeout=True, + **ES_OPTIONS, ) if es.ping(): try: @@ -88,6 +91,7 @@ def create_index_es(): timeout=ES_TIMEOUT, max_retries=ES_MAX_RETRIES, retry_on_timeout=True, + **ES_OPTIONS, ) if ES_VERSION in [7, 8]: template_file = "pod/video_search/search_template7.json" @@ -117,6 +121,7 @@ def delete_index_es(): timeout=ES_TIMEOUT, max_retries=ES_MAX_RETRIES, retry_on_timeout=True, + **ES_OPTIONS, ) try: delete = es.indices.delete(index=ES_INDEX) diff --git a/pod/video_search/views.py b/pod/video_search/views.py index 041194b223..721696155e 100644 --- a/pod/video_search/views.py +++ b/pod/video_search/views.py @@ -16,6 +16,7 @@ ES_TIMEOUT = getattr(settings, "ES_TIMEOUT", 30) ES_MAX_RETRIES = getattr(settings, "ES_MAX_RETRIES", 10) ES_VERSION = getattr(settings, "ES_VERSION", 6) +ES_OPTIONS = getattr(settings, "ES_OPTIONS", {}) def get_filter_search(selected_facets, start_date, end_date): @@ -103,6 +104,7 @@ def search_videos(request): timeout=ES_TIMEOUT, max_retries=ES_MAX_RETRIES, retry_on_timeout=True, + **ES_OPTIONS, ) aggsAttrs = [ "owner_full_name",