Skip to content

Commit

Permalink
fix(elasticsearch): Ensure deterministic order for auxiliary queries
Browse files Browse the repository at this point in the history
  • Loading branch information
ERosendo committed Nov 18, 2024
1 parent 1f1fbc8 commit ed53924
Showing 1 changed file with 2 additions and 0 deletions.
2 changes: 2 additions & 0 deletions cl/lib/elasticsearch_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -3220,6 +3220,7 @@ def do_es_sweep_alert_query(
from_=0, size=settings.SCHEDULED_ALERT_HITS_LIMIT
)
parent_search = parent_search.source(includes=["docket_id"])
parent_search = parent_search.sort(build_sort_results(cd))
multi_search = multi_search.add(parent_search)

if child_query:
Expand All @@ -3230,6 +3231,7 @@ def do_es_sweep_alert_query(
* settings.RECAP_CHILD_HITS_PER_RESULT,
)
child_search = child_search.source(includes=["id"])
child_search = child_search.sort({"_score": {"order": "desc"}})
multi_search = multi_search.add(child_search)

responses = multi_search.execute()
Expand Down

0 comments on commit ed53924

Please sign in to comment.