Skip to content

Optimize pagination query#250

Merged
chosak merged 1 commit into
mainfrom
optimize/pagination
Jul 21, 2026
Merged

Optimize pagination query#250
chosak merged 1 commit into
mainfrom
optimize/pagination

Conversation

@chosak

@chosak chosak commented Jul 21, 2026

Copy link
Copy Markdown
Member

The search API response includes a set of "break points" which can be used as pagination offsets in subsequent queries. These break points are always computed if the search response would contain more than one page of results. Break points are computed via a second OpenSearch query.

Currently, that second query is essentially a duplicate of the original search, which means that includes all of its bells and whistles: computing aggregations, highlighting results, etc. We don't actually need any of that stuff, and it's very expensive to compute. The second search can and should only be used to return break points.

This change modifies that second search to remove those extraneous features from the OpenSearch query.

@chosak
chosak requested review from flacoman91 and higs4281 July 21, 2026 19:06

@higs4281 higs4281 left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Another great catch.

The search API response includes a set of "break points" which can be
used as pagination offsets in subsequent queries. These break points
are always computed if the search response would contain more than one
page of results. Break points are computed via a second OpenSearch
query.

Currently, that second query is essentially a duplicate of the original
search, which means that includes all of its bells and whistles:
computing aggregations, highlighting results, etc. We don't actually
need any of that stuff, and it's very expensive to compute. The second
search can and should only be used to return break points.

This change modifies that second search to remove those extraneous
features from the OpenSearch query.
@chosak
chosak force-pushed the optimize/pagination branch from 15f55d8 to f648ce3 Compare July 21, 2026 19:33
@chosak
chosak merged commit afec70a into main Jul 21, 2026
2 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants