Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 8 additions & 6 deletions complaint_search/es_interface.py
Original file line number Diff line number Diff line change
Expand Up @@ -259,7 +259,8 @@ def search(agg_exclude=None, **kwargs):
- Update params with request details.
- Add a formatted 'search_after' param if pagination is requested.
- Build a search body based on params
- Add param-based post_filter and aggregation sections to the search body.
- Add param-based post_filter to the search body.
- Add aggregations to the search body, unless no_aggs is specified.
- Add a track_total_hits directive to get accurate hit counts (new in 2021)
- Assemble pagination break points if needed.

Expand All @@ -284,11 +285,12 @@ def search(agg_exclude=None, **kwargs):
res = {}
_format = params.get("format")
if _format == "default":
aggregation_builder = AggregationBuilder()
aggregation_builder.add(**params)
if agg_exclude:
aggregation_builder.add_exclude(agg_exclude)
body["aggs"] = aggregation_builder.build()
if not params.get("no_aggs"):
aggregation_builder = AggregationBuilder()
aggregation_builder.add(**params)
if agg_exclude:
aggregation_builder.add_exclude(agg_exclude)
body["aggs"] = aggregation_builder.build()
log.info(
"Requesting %s/%s/_search with %s",
_ES_URL,
Expand Down
Loading