Fix incorrect ES query (merge issue)

This commit is contained in:
allegroai 2021-07-25 14:40:49 +03:00
parent 6488dc54e6
commit 694dbc31c4

View File

@ -930,6 +930,9 @@ class EventBLL(object):
task_ids = [task_id] if isinstance(task_id, str) else task_id
es_req: dict = {
"size": 0,
"aggs": {
"tasks": {
"terms": {"field": "task"},
"aggs": {
"iters": {
"terms": {
@ -939,12 +942,14 @@ class EventBLL(object):
}
}
},
}
},
"query": {"bool": {"must": [{"terms": {"task": task_ids}}]}},
}
with translate_errors_context(), TimingContext("es", "task_last_iter"):
es_res = search_company_events(
self.es, company_id=company_id, event_type=event_type, body=es_req
self.es, company_id=company_id, event_type=event_type, body=es_req,
)
if "aggregations" not in es_res: