diff --git a/service/src/main/inse/dashboard/service.py b/service/src/main/inse/dashboard/service.py index 42f8a9b6..ce9a9b2b 100644 --- a/service/src/main/inse/dashboard/service.py +++ b/service/src/main/inse/dashboard/service.py @@ -182,7 +182,7 @@ async def get_dashboard_dfg_projects( normalized_id = _normalize_institution_id(institution_id) aliases = await _institution_aliases(normalized_id, organization_name) response = await elasticsearch.search( - index=ESIndex.PROJECTS_DFG_ALL, + index=ESIndex.DFG_PROJECTS, query=_dfg_institution_query(aliases), size=0, track_total_hits=True, @@ -639,7 +639,7 @@ async def _top_dfg_project_author_buckets( aliases: list[str], ) -> list[dict[str, Any]]: response = await elasticsearch.search( - index=ESIndex.PROJECTS_DFG_ALL, + index=ESIndex.DFG_PROJECTS, body={ "size": 0, "query": _dfg_institution_query(aliases), diff --git a/service/src/main/inse/dashboard/test_service.py b/service/src/main/inse/dashboard/test_service.py index ca3288b8..0d2914c0 100644 --- a/service/src/main/inse/dashboard/test_service.py +++ b/service/src/main/inse/dashboard/test_service.py @@ -68,7 +68,7 @@ async def test_dashboard_statistics_counts_organization_data_and_all_projects(): assert [call.kwargs["index"] for call in calls[2:]] == [ ESIndex.CORDIS_EU_ORGANIZATIONS_WILDCARD, ESIndex.PROJECTS_BUND_V1, - ESIndex.PROJECTS_DFG_ALL, + ESIndex.DFG_PROJECTS, ] assert calls[2].kwargs["body"]["query"] == { "terms": { @@ -131,7 +131,7 @@ async def test_top_authors_maps_works_and_dfg_project_aggregations(): } } } - if kwargs["index"] == ESIndex.PROJECTS_DFG_ALL: + if kwargs["index"] == ESIndex.DFG_PROJECTS: return { "aggregations": { "people": { @@ -181,10 +181,10 @@ async def test_top_authors_maps_works_and_dfg_project_aggregations(): call for call in mocked_search.await_args_list if call.kwargs["index"] - in {ESIndex.PROJECTS_DFG_ALL, ESIndex.PROJECTS_BUND_V1} + in {ESIndex.DFG_PROJECTS, ESIndex.PROJECTS_BUND_V1} ] assert len(project_calls) == 1 - assert project_calls[0].kwargs["index"] == ESIndex.PROJECTS_DFG_ALL + assert project_calls[0].kwargs["index"] == ESIndex.DFG_PROJECTS assert project_calls[0].kwargs["body"]["query"]["bool"][ "minimum_should_match" ] == 1 @@ -198,7 +198,7 @@ async def test_top_authors_keeps_dfg_project_authors_without_openalex_match(): async def search(**kwargs): if kwargs["index"] == ESIndex.OPENALEX_AUTHORS: return {"hits": {"hits": []}} - if kwargs["index"] == ESIndex.PROJECTS_DFG_ALL: + if kwargs["index"] == ESIndex.DFG_PROJECTS: return { "aggregations": { "people": { @@ -232,7 +232,7 @@ async def test_top_authors_returns_top_ten_dfg_project_people_by_project_count() async def search(**kwargs): if kwargs["index"] == ESIndex.OPENALEX_AUTHORS: return {"hits": {"hits": []}} - if kwargs["index"] == ESIndex.PROJECTS_DFG_ALL: + if kwargs["index"] == ESIndex.DFG_PROJECTS: return { "aggregations": { "people": { @@ -280,7 +280,7 @@ async def test_top_authors_combines_dfg_involved_people_case_insensitively(): ] } } - if kwargs["index"] == ESIndex.PROJECTS_DFG_ALL: + if kwargs["index"] == ESIndex.DFG_PROJECTS: return { "aggregations": { "people": { diff --git a/service/src/main/inse/integrations/elasticsearch.py b/service/src/main/inse/integrations/elasticsearch.py index b58065cf..49e02d85 100644 --- a/service/src/main/inse/integrations/elasticsearch.py +++ b/service/src/main/inse/integrations/elasticsearch.py @@ -100,7 +100,7 @@ def _index_to_cluster(index: ESIndex) -> Optional[ESCluster]: ESIndex.CORDIS_EU_PROJECTS_WILDCARD, ESIndex.CORDIS_EU_PUBLICATIONS_WILDCARD, ESIndex.PROJECTS_BUND_V1, - ESIndex.PROJECTS_DFG_ALL, + ESIndex.DFG_PROJECTS, }: return ESCluster.INSE else: diff --git a/service/src/main/inse/projects/dfg_institutions/service.py b/service/src/main/inse/projects/dfg_institutions/service.py index aeb1f5e4..71c687b0 100644 --- a/service/src/main/inse/projects/dfg_institutions/service.py +++ b/service/src/main/inse/projects/dfg_institutions/service.py @@ -32,7 +32,7 @@ async def search_institutions( DfgInstitutionSummaryPage: A page of institutions matching the search criteria. """ response = await elasticsearch.search( - index=ESIndex.PROJECTS_DFG_INSTITUTES, + index=ESIndex.DFG_INSTITUTES, cluster=ESCluster.INSE, query=query, source=source, diff --git a/service/src/main/inse/projects/dfg_persons/service.py b/service/src/main/inse/projects/dfg_persons/service.py index 9685add4..a0929cb7 100644 --- a/service/src/main/inse/projects/dfg_persons/service.py +++ b/service/src/main/inse/projects/dfg_persons/service.py @@ -32,7 +32,7 @@ async def search_persons( """ print(query) response = await elasticsearch.search( - index=ESIndex.PROJECTS_DFG_PERSONS, + index=ESIndex.DFG_PERSONS, cluster=ESCluster.INSE, query=query, source=source,