From 627c6fd1679fe738c6d31ccb40818ccf356e3adb Mon Sep 17 00:00:00 2001 From: SG Date: Wed, 24 Jan 2024 16:37:41 -0700 Subject: [PATCH] work in progress for idaholab/Malcolm#386, include missing aggregations in API bucket queries --- api/project/__init__.py | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/api/project/__init__.py b/api/project/__init__.py index 8cf90cb0b..0a105bc3d 100644 --- a/api/project/__init__.py +++ b/api/project/__init__.py @@ -561,17 +561,20 @@ def aggfields(fieldnames, current_request, urls=None): aggCount = 0 for fname in get_iterable(fieldnames): aggCount += 1 + # TODO: missing string needs to match the type of the field + # "error": "RequestError: RequestError(400, 'search_phase_execution_exception', \"'__missing__' is not an IP string literal.\")" last_bucket = last_bucket.bucket( f"values_{aggCount}", "terms", field=fname, size=bucket_limit, + missing="__missing__", ) response = s.execute() if (urls is not None) and (len(urls) > 0): return jsonify( - values=response.aggregations.to_dict().get("values", {}), + values=response.aggregations.to_dict().get("values_1", {}), range=(start_time_ms // 1000, end_time_ms // 1000), filter=filters, fields=get_iterable(fieldnames), @@ -579,7 +582,7 @@ def aggfields(fieldnames, current_request, urls=None): ) else: return jsonify( - values=response.aggregations.to_dict().get("values", {}), + values=response.aggregations.to_dict().get("values_1", {}), range=(start_time_ms // 1000, end_time_ms // 1000), filter=filters, fields=get_iterable(fieldnames),