# ElasticSearch: search\_after with refresh

**URL:** <https://discuss.elastic.co/t/elasticsearch-search-after-with-refresh/292608>\
**Category:** Elasticsearch\
**Created:** [December 21, 2021, 7:50pm UTC](https://discuss.elastic.co/t/elasticsearch-search-after-with-refresh/292608 "2021-12-21T19:50:38Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![sag-tobias-frey](https://avatars.discourse-cdn.com/v4/letter/s/d26b3c/32.png) [@sag-tobias-frey](https://discuss.elastic.co/u/sag-tobias-frey)\
**Post date:** [December 21, 2021, 7:50pm UTC](https://discuss.elastic.co/t/elasticsearch-search-after-with-refresh/292608/1 "2021-12-21T19:50:38Z")

</div>

Hello,

I have searched for quite some time but did not find an answer yet. I'm currently looking into doing some pagination over my data. I have stumbled across the **search\_after** functionality. The queries work quite nice but I'm a bit worried about the following sentences from the documentation:

> Using `search_after` requires multiple search requests with the same `query` and `sort` values. If a [refresh](https://www.elastic.co/guide/en/elasticsearch/reference/7.16/near-real-time.html) occurs between these requests, the order of your results may change, causing inconsistent results across pages. To prevent this, you can create a [point in time (PIT)](https://www.elastic.co/guide/en/elasticsearch/reference/7.16/point-in-time-api.html) to preserve the current index state over your searches.

The documentation is saying that there may be inconsistent results if there is a refresh in between the requests. However, is this also true even if no document matching my previous query is added / changed / deleted? or is search\_after safe to use in this case?

I'm actually asking because as far as I know PITs are currently not supported in the high level rest client and I would be happy not needing to use the low level client.

Kind regards,  
Tobias

---

<div class="post-metadata">

**Author:** ![warkolm](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/warkolm/32/39224_2.png) [@warkolm](https://discuss.elastic.co/u/warkolm)\
**Post date:** [December 21, 2021, 9:18pm UTC](https://discuss.elastic.co/t/elasticsearch-search-after-with-refresh/292608/2 "2021-12-21T21:18:17Z")

</div>

Technically yes, because that change would cause a refresh to happen.

---

<div class="post-metadata">

**Author:** ![system](https://us1.discourse-cdn.com/elastic/original/3X/1/a/1ac57faf039f6b580b3f104ef42a2a89e41014de.png) [@system](https://discuss.elastic.co/u/system)\
**Post date:** [January 18, 2022, 9:18pm UTC](https://discuss.elastic.co/t/elasticsearch-search-after-with-refresh/292608/3 "2022-01-18T21:18:55Z")

</div>

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