Skip to content

Commit

Permalink
fix: deleting individually from real index. not from alias
Browse files Browse the repository at this point in the history
  • Loading branch information
wphyojpl committed Dec 16, 2024
1 parent d178ce9 commit c1f340c
Showing 1 changed file with 7 additions and 5 deletions.
12 changes: 7 additions & 5 deletions cumulus_lambda_functions/lib/uds_db/granules_db_index.py
Original file line number Diff line number Diff line change
Expand Up @@ -209,11 +209,13 @@ def delete_entry(self, tenant: str, tenant_venue: str, doc_id: str, ):
}, read_alias_name)
if result is None:
raise ValueError(f"no such granule: {doc_id}")
delete_result = self.__es.delete_by_query({
'query': {'term': {'_id': doc_id}}
}, read_alias_name)
if delete_result is None:
raise ValueError(f"no such granule: {doc_id}")
for each_granule in result['hits']['hits']:
delete_result = self.__es.delete_by_query({
'query': {'term': {'_id': each_granule['_id']}}
}, each_granule['_index'])
LOGGER.debug(f'delete_result: {delete_result}')
if delete_result is None:
raise ValueError(f"error deleting {each_granule}")
return result

def update_entry(self, tenant: str, tenant_venue: str, json_body: dict, doc_id: str, ):
Expand Down

0 comments on commit c1f340c

Please sign in to comment.