-
Notifications
You must be signed in to change notification settings - Fork 561
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Search requests allow navigating back and forth #18749
Comments
@tmetzke the proposal makes sense to me and seems to provide a user value to develop custom frontend applications. Thank you ⭐ Just one question: can I jump to the last page with this approach? |
@aleksander-dytko, no, because you don't know the sort values of the last item. You don't even know how many items you have overall. This is not really meant for classic pagination (with a page counter at the bottom and navigation to the first, previous, next, and last pages). It's more about supporting moving back and forth properly in infinite scrolling. Allowing to get the first page is simply possible since you can leave out the |
If we'd want to support "classic" offset pagination, we could add this. But with ES/OS, this is limited to 10k items. Which should be fine for many cases. But we can add this later on top with new parameters for the |
Thanks for clarifying that @tmetzke. I agree with the approach above to start with the first iteration as in the proposal 🚀 |
Great proposal @tmetzke |
@nathansandi, I added an example. The sort values arrays can contain any set of types since they reflect the values of the attributes defined in the request's Hope that clarifies things. |
Description
As a follow-up of #16947, the search response schema is extended to allow navigating back and forth in search results. Currently, navigating back is not possible with the proposed schema.
Proposal
The search response schema is extended to contain the
sortValues
of the last and first items of the result set.Regarding the example from the guidelines with the following request:
You'd receive the following (shortened) response:
The schema replaces the current
sortValues
attribute in thepage
object withfirstItemSortValues
andlastItemSortValues
. Those contain thesortValues
of the first and last item of the returned result set. The sort values arrays contain the values of the attributes from the requestssort
object for the respective result item (in the example above: thestate
attribute value of the first and last item respectively), plus our internal tiebreaker (the internalkey
of the record).This allows navigating the result set as follows:
searchBefore
with the values fromfirstItemSortValues
, i.e. fetching the values before the current first item.searchAfter
with the values fromlastItemSortValues
, i.e. fetching the values after the current last item.searchBefore
andsearchAfter
Decisions
Will be filled in by the project DRIs after a peer review phase.
The text was updated successfully, but these errors were encountered: