Elasticsearch Pagination

Hi,

In my .Net application, i'm using Elasticsearch 2.3.4 as search engine.

In my UserInterface layer, i want to implement pagination to display retrieved response.

I'm trying to understand Pagination (From & Size) Vs Scroll in detailed. (Any inputs reg. this is really appreciated.)

Clarifications:

  1. Using Pagination (From & Size), while traversing (Progressive scrolling) between pages will there any phantom reads? If yes, how to handle it ?
    For Ex.: Consider as below,
    Total number of docs. filtered : 30
    Page Size : 10

Now while traversing between 3 pages, 10 new docs. got inserted. I still want to display only the 30 docs (without 10 new docs) in my user interface. How to implement this ?

  1. Using Scroll, In my user interface On "Next Page" click (Progressive scrolling) I'll issue scroll_id received in previous response instead of scrolling thro all docs at once .
    For Ex.: Consider as below,
    Total number of docs. filtered : 30
    Page Size : 10
    Scroll Time : 20ms

Now the 10 docs & scroll_id issued in first search request will be returned to UserInterface and On "Next page" click scroll request will be placed with the received scroll_id.
How to handle "Previous page" Click ?
Is there any way to set expiry for Scroll_id ?

Regards,
Sreeram