Skip to content
This repository was archived by the owner on Oct 3, 2025. It is now read-only.
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 8 additions & 2 deletions bag/search/index.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
from django.db.models.functions import Cast
from elasticsearch import helpers
from elasticsearch.client import IndicesClient
from elasticsearch.exceptions import NotFoundError
from elasticsearch.exceptions import NotFoundError, RequestError
from elasticsearch_dsl.connections import connections

from datasets.generic.database import count_qs
Expand Down Expand Up @@ -49,7 +49,13 @@ def execute(self):
for dt in self.doc_types:
idx.doc_type(dt)

idx.create()
try:
idx.create()
except RequestError as e:
if 'resource_already_exists_exception' in str(e.info['error']):
pass
else:
raise


class ImportIndexTask(object):
Expand Down