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

@ -931,12 +931,17 @@ class EventBLL(object):
es_req: dict = { es_req: dict = {
"size": 0, "size": 0,
"aggs": { "aggs": {
"iters": { "tasks": {
"terms": { "terms": {"field": "task"},
"field": "iter", "aggs": {
"size": iters, "iters": {
"order": {"_key": "desc"}, "terms": {
} "field": "iter",
"size": iters,
"order": {"_key": "desc"},
}
}
},
} }
}, },
"query": {"bool": {"must": [{"terms": {"task": task_ids}}]}}, "query": {"bool": {"must": [{"terms": {"task": task_ids}}]}},
@ -944,7 +949,7 @@ class EventBLL(object):
with translate_errors_context(), TimingContext("es", "task_last_iter"): with translate_errors_context(), TimingContext("es", "task_last_iter"):
es_res = search_company_events( 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: if "aggregations" not in es_res: