Skip to content

Commit

Permalink
avoid exception if index not found DOAJ/doajPM#4031
Browse files Browse the repository at this point in the history
  • Loading branch information
philipkcl committed Dec 26, 2024
1 parent 023f309 commit 95c6f13
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions portality/dao.py
Original file line number Diff line number Diff line change
Expand Up @@ -1090,8 +1090,9 @@ def _yield_index_alias():
def is_exist(query: dict, index):
query['size'] = 1
query['_source'] = False
res = ES.search(body=query, index=index, size=1)
return res['hits']['total']['value'] > 0
res = ES.search(body=query, index=index, size=1, ignore=[404])

return res.get('hits', {}).get('total',{}).get('value', 0) > 0


class BlockTimeOutException(Exception):
Expand Down

0 comments on commit 95c6f13

Please sign in to comment.