As someone knows, size/from pagination isn't the best way to do paging with large results.
I would like to use search_after but allowing the user to set the page number so I would need the last document _id for each page to do this.
Is there any way to get the "last document _id" using some kind of aggregation?
Like grouping by hit number and getting the last.
As an example, lets say I have 10 results per page, so I need _id for results 10, 20, 30 and so on.
Maybe with some scripted field?
I'm not sure where to go with this.
Thanks in advance