diff --git a/complaint_search/es_interface.py b/complaint_search/es_interface.py index 59a32ce..7e609e1 100644 --- a/complaint_search/es_interface.py +++ b/complaint_search/es_interface.py @@ -305,6 +305,14 @@ def search(agg_exclude=None, **kwargs): if hit_total and hit_total > user_batch_size: # We have more than one page of results and need pagination pagination_body = copy.deepcopy(body) + + # When determining break points, we don't need to recompute + # aggregations, re-highlight, or return result source. + pagination_body.pop("aggs", None) + pagination_body.pop("highlight", None) + pagination_body["_source"] = False + pagination_body["track_total_hits"] = False + # cleaner to get page from frontend, but 'frm' works for now page = params.get("frm", user_batch_size) / user_batch_size pagination_body["size"] = get_pagination_query_size(