Search_after for pagination

I want to implement pagination using search_after instead of from, size. There are different sortings in our website like sort by relevancy or a-z or z-a or lowest to highest… How will the sort values for search_after considered in this cases. What will be the changes required on the UI side. Can I use next and previous buttons or only load more button?

Which one is ideal for a e-commerce B2B website, search_after or from size?

With search_after you can't go back to the previous page. If you need to do that, you will have to store in your app layer, the hits you have already downloaded or each search_after array result to provide it again to the search request.

There's no real change with the sort capabilities so that should not have an impact on the UI.

Out of curiosity, why do you want to make this change?

Thanks for your response.

There was a recommendation : Pagination is currently performed by applying `from` and `size` parameters to the search. This is inefficient as the entire query is run for every page. A more efficient alternative is to use `search_after`, which enables Elasticsearch to only read the documents that are required for the page being requested.

Yes but the question is about the user behavior. Are they using frequently the "next page" button? How does this affect the performance?

I mean that I wouldn't try to solve a problem I just don't really have.

So is there any problem with the current implementation?