Skip to content

Commit

Permalink
Bug fix
Browse files Browse the repository at this point in the history
Signed-off-by: Muhammad Mikaal S. Anwar <[email protected]>
  • Loading branch information
mikaalanwar committed Sep 21, 2023
1 parent 1edf9cd commit 74f8fc5
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions search/search_service/proxy/es_proxy_v2_1.py
Original file line number Diff line number Diff line change
Expand Up @@ -364,16 +364,17 @@ def search(self, *,

for resource in resource_types:
# guard clause to prevent search in missing indices or aliases
aliases_in_es = self.elasticsearch.indices.get_alias().keys()
if self.get_index_alias_for_resource(resource_type=resource) not in aliases_in_es:
aliases_in_es = {alias['alias'] for alias in self.elasticsearch.cat.aliases(format="json")}
resource_alias = self.get_index_alias_for_resource(resource_type=resource)
if resource_alias not in aliases_in_es:
continue

# build a query for each resource to search
query_for_resource = self._build_elasticsearch_query(resource=resource,
query_term=query_term,
filters=filters)
# wrap the query in a search object
search = Search(index=self.get_index_alias_for_resource(resource_type=resource)).query(query_for_resource)
search = Search(index=resource_alias).query(query_for_resource)

# highlighting
if highlight_options:
Expand Down

0 comments on commit 74f8fc5

Please sign in to comment.