This commit is contained in:
parent
f52c13e082
commit
b26da8f316
|
@ -96,16 +96,16 @@ class SearchService:
|
||||||
if self.client:
|
if self.client:
|
||||||
if self.lock.acquire(blocking=False):
|
if self.lock.acquire(blocking=False):
|
||||||
try:
|
try:
|
||||||
logger.debug(f' Создаём новый индекс: {self.index_name} ')
|
logger.debug(f'Recreating index: {self.index_name}')
|
||||||
self.client.indices.create(
|
self.delete_index()
|
||||||
index=self.index_name, body=index_settings
|
self.check_index()
|
||||||
)
|
logger.debug(f'Index {self.index_name} recreated')
|
||||||
self.client.indices.close(index=self.index_name)
|
except Exception as e:
|
||||||
self.client.indices.open(index=self.index_name)
|
logger.debug(f'Error recreating index: {str(e)}')
|
||||||
finally:
|
finally:
|
||||||
self.lock.release()
|
self.lock.release()
|
||||||
else:
|
else:
|
||||||
logger.debug(' ..')
|
logger.debug('Unable to acquire lock to recreate index')
|
||||||
|
|
||||||
def put_mapping(self):
|
def put_mapping(self):
|
||||||
if self.client:
|
if self.client:
|
||||||
|
|
Loading…
Reference in New Issue
Block a user