# Search\_after doesn't work as expected

**URL:** <https://discuss.elastic.co/t/search-after-doesnt-work-as-expected/116841>\
**Category:** Elasticsearch\
**Created:** [January 24, 2018, 10:05am UTC](https://discuss.elastic.co/t/search-after-doesnt-work-as-expected/116841 "2018-01-24T10:05:16Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![doritn](https://avatars.discourse-cdn.com/v4/letter/d/ce73a5/32.png) [@doritn](https://discuss.elastic.co/u/doritn)\
**Post date:** [January 24, 2018, 10:05am UTC](https://discuss.elastic.co/t/search-after-doesnt-work-as-expected/116841/1 "2018-01-24T10:05:16Z")

</div>

Hi,

I'm trying to use polling on an index in order to retrieve the latest state (my document contain state) per managed entity.  
I can't use the timestamp since the same timestamp can be used for multiple documents. In addition, since documents are indexed in parallel, it may be that a later document is indexed before earlier document.

I tried to use the search\_after feature but it is not working as expected - for example, having the following doc:  
doc1, t1, \_id1  
doc2, t1, \_id2

doc3, t2, \_id3  
doc4, t2, \_id3

when using the search\_after with t1, \_id2 - i don't get doc3 and doc4.

Any idea?

Thanks,  
Dorit

---

<div class="post-metadata">

**Author:** ![jimczi](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/jimczi/32/47985_2.png) [@jimczi](https://discuss.elastic.co/u/jimczi)\
**Post date:** [January 26, 2018, 9:12am UTC](https://discuss.elastic.co/t/search-after-doesnt-work-as-expected/116841/2 "2018-01-26T09:12:07Z")

</div>

Can you post the requests and responses that you sent/received and the version of es that you used ?  
Are you able to reproduce with a simple recreation ?  
What is `_id` ? The unique identifier of the documents ?

---

<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:** [February 23, 2018, 9:12am UTC](https://discuss.elastic.co/t/search-after-doesnt-work-as-expected/116841/3 "2018-02-23T09:12:29Z")

</div>

Closed on February 23, 2018, 9:12am UTC

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