From daed34caa06f94bd85d4560298bf4ccc156164ff Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C3=85dne=20Jacobsen?= <88316787+adnejacobsen@users.noreply.github.com> Date: Tue, 15 Aug 2023 09:03:52 +0200 Subject: [PATCH] Update case.iterations to use uuid instead of id (#196) --- src/fmu/sumo/explorer/objects/case.py | 17 ++++++++--------- 1 file changed, 8 insertions(+), 9 deletions(-) diff --git a/src/fmu/sumo/explorer/objects/case.py b/src/fmu/sumo/explorer/objects/case.py index 527ab958..8aa728e8 100644 --- a/src/fmu/sumo/explorer/objects/case.py +++ b/src/fmu/sumo/explorer/objects/case.py @@ -53,19 +53,18 @@ def iterations(self) -> List[Dict]: query = { "query": {"term": {"_sumo.parent_object.keyword": self.uuid}}, "aggs": { - "id": { - "terms": {"field": "fmu.iteration.id", "size": 50}, + "uuid": { + "terms": {"field": "fmu.iteration.uuid.keyword", "size": 50}, "aggs": { "name": { "terms": { - "field": "fmu.iteration.name.keyword", - "size": 1, + "field": "fmu.iteration.name.keyword", + "size": 1 } }, "realizations": { - "terms": { + "cardinality": { "field": "fmu.realization.id", - "size": 1000, } }, }, @@ -75,15 +74,15 @@ def iterations(self) -> List[Dict]: } res = self._sumo.post("/search", json=query) - buckets = res.json()["aggregations"]["id"]["buckets"] + buckets = res.json()["aggregations"]["uuid"]["buckets"] iterations = [] for bucket in buckets: iterations.append( { - "id": bucket["key"], + "uuid": bucket["key"], "name": bucket["name"]["buckets"][0]["key"], - "realizations": len(bucket["realizations"]["buckets"]), + "realizations": bucket["realizations"]["value"], } )