Skip to content

Commit

Permalink
Update utils.py
Browse files Browse the repository at this point in the history
  • Loading branch information
CartierPierre authored Dec 4, 2023
1 parent 142fed6 commit 84e6265
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions pod/video_search/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -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):
Expand All @@ -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:
Expand Down Expand Up @@ -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:
Expand Down Expand Up @@ -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"
Expand Down Expand Up @@ -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)
Expand Down

0 comments on commit 84e6265

Please sign in to comment.