Pagination Search - page 1 to page 5

Hi,

We're trying to implement pagination for our application. We are displaying a table with 10 results per page. And we're wondering if it's possible to go from page 1 (record 1-10) to page 5 (record 51-60) in one jump.

Our current logic will allow us to go from 1,2,3,4,5 but not in one go.

{
    "query": {
        "match": {
            "title": "elasticsearch"
        }
    },
    "search_after": [1463538857, "654323"],
    "sort": [
        {"date": "asc"},
        {"tie_breaker_id": "asc"}
    ]
}

How do we know what the 50th record is to be able to set the keys to search after and load page 5 in one jump? Hope this makes sense, let me know if additional context is required. I assume this is possible as it's a requirement for many dbs...

Thanks,

Jason

Hi @Jasonespo

I recommend read this article Elasticsearch Pagination Techniques: SearchAfter, Scroll, Pagination & PIT

This topic was automatically closed 28 days after the last reply. New replies are no longer allowed.