Skip to content

Commit

Permalink
work in progress for idaholab#386, include missing aggregations in AP…
Browse files Browse the repository at this point in the history
…I bucket queries
  • Loading branch information
mmguero committed Jan 24, 2024
1 parent daff03f commit 627c6fd
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions api/project/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -561,25 +561,28 @@ 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),
urls=urls,
)
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),
Expand Down

0 comments on commit 627c6fd

Please sign in to comment.