Skip to content

Commit

Permalink
Update case.iterations to use uuid instead of id (#196)
Browse files Browse the repository at this point in the history
  • Loading branch information
adnejacobsen authored Aug 15, 2023
1 parent 17c9e37 commit daed34c
Showing 1 changed file with 8 additions and 9 deletions.
17 changes: 8 additions & 9 deletions src/fmu/sumo/explorer/objects/case.py
Original file line number Diff line number Diff line change
Expand Up @@ -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,
}
},
},
Expand All @@ -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"],
}
)

Expand Down

0 comments on commit daed34c

Please sign in to comment.