-
Notifications
You must be signed in to change notification settings - Fork 802
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
Implement efficient pagination helpers using search_after #802
Comments
All the My question is whether it is OK like this or if we should implement the What do people think? |
While discarding unused docs is ok when Is there a way to resolve this efficiently? I thought that |
@drpump thank you for the reaction! There is currently no other way to do it efficiently, according to Jim, feel free to ask any questions on the elasticsearch ticket, but from what I understand the elasticsearch team is not super happy with
|
Thanks, so I have 3 solutions I could implement:
All are client side solutions. I'd need to implement a new searcher class in Rails or monkey patch the elasticsearch gems. Doable if perhaps a bit messy. |
When using search_after, we need to choose a unique sort key. And there was a little difficulty in choosing. |
Currently any of the pagination needs to be done manually either via slicing (which can be inefficient for deep pagination) or using
search_after
(0), which can be complex. What I propose is to introduce several new methods onSearch
objects:and helper methods on
Response
to retrievelast_hit
andfirst_hit
(self.hits[0/-1].meta.sort
) and also to directly use those to callget_next/previous_page
.0 - https://www.elastic.co/guide/en/elasticsearch/reference/6.1/search-request-search-after.html
Or do people think this should be a separate object/module altogether? is there anything I am missing? (number of pages? Direct jump to last/first page?
The text was updated successfully, but these errors were encountered: