From 235f5fe1b8ae7577e021848117e6cf20505d10ff Mon Sep 17 00:00:00 2001 From: seolmin Date: Fri, 24 Jan 2025 13:13:00 +0900 Subject: [PATCH] feat: change search index in Cost Model --- src/spaceone/cost_analysis/manager/cost_manager.py | 1 + src/spaceone/cost_analysis/model/cost_model.py | 3 ++- 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/src/spaceone/cost_analysis/manager/cost_manager.py b/src/spaceone/cost_analysis/manager/cost_manager.py index bc819886..1309f114 100644 --- a/src/spaceone/cost_analysis/manager/cost_manager.py +++ b/src/spaceone/cost_analysis/manager/cost_manager.py @@ -147,6 +147,7 @@ def analyze_costs(self, query, domain_id, target="SECONDARY_PREFERRED"): _LOGGER.debug(f"[analyze_costs] query: {query}") query = self._change_filter_project_group_id(query, domain_id) + query["hint"] = "COMPOUND_INDEX_FOR_SEARCH" return self.cost_model.analyze(**query) def analyze_monthly_costs(self, query, domain_id, target="SECONDARY_PREFERRED"): diff --git a/src/spaceone/cost_analysis/model/cost_model.py b/src/spaceone/cost_analysis/model/cost_model.py index e395c340..6d9430f5 100644 --- a/src/spaceone/cost_analysis/model/cost_model.py +++ b/src/spaceone/cost_analysis/model/cost_model.py @@ -62,9 +62,10 @@ class Cost(MongoModel): "fields": [ "domain_id", "data_source_id", - "-billed_date", "workspace_id", "project_id", + "product", + "-billed_date", "cost", ], "name": "COMPOUND_INDEX_FOR_SEARCH",