# terminateAfter and sorting

**URL:** <https://discuss.elastic.co/t/terminateafter-and-sorting/63228>\
**Category:** Elasticsearch\
**Created:** [October 17, 2016, 10:15pm UTC](https://discuss.elastic.co/t/terminateafter-and-sorting/63228 "2016-10-17T22:15:22Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![EuclideanSearch](https://avatars.discourse-cdn.com/v4/letter/e/c77e96/32.png) [@EuclideanSearch](https://discuss.elastic.co/u/EuclideanSearch)\
**Post date:** [October 17, 2016, 10:15pm UTC](https://discuss.elastic.co/t/terminateafter-and-sorting/63228/1 "2016-10-17T22:15:22Z")

</div>

Hi. From the description of terminateAfter its not clear if this works with sorting. IE if the query would (without terminateAfter) result in 100 documents and terminateAfter=10 then would sorting (for instance on my\_field ASCENDING) with limit=10 still give you the smallest 10 docs?

From the docs "An optional document count, upon collecting which the search query will early terminate"

---

<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:** [July 5, 2017, 10:11pm UTC](https://discuss.elastic.co/t/terminateafter-and-sorting/63228/2 "2017-07-05T22:11:39Z")

</div>


