Search After Pagination with sort field in Query

Hi,

I am using search after pagination logic for deep pagination.
The search query extracts documents with a specific DateTime range.

                  {
                    "range": {
                      "my_date_time": {
                        "gte": "2021-08-10T15:05:00.000Z",
                        "lt": "2021-08-10T15:10:00.000Z"
                      }
                    }
                  }

my_date_time field which is used to identify DateTime in the query is being used as the sorting field with ASC order.

For the search after logic to work, the last document's DateTime should be used with search_after in the next query.

Would there be any performance benefit if the last document's DateTime is used in gte of range query i.e. modifying the range query for every next page with the last document's DateTime value of current page.

Your solution will return different documents to what the search after pagination will do - so I am unsure what you asking? Maybe you can clarify?

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