# Sort is out of order - using Nested Filter

**URL:** <https://discuss.elastic.co/t/sort-is-out-of-order-using-nested-filter/159070>\
**Category:** Elasticsearch\
**Created:** [December 3, 2018, 1:28am UTC](https://discuss.elastic.co/t/sort-is-out-of-order-using-nested-filter/159070 "2018-12-03T01:28:32Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![sagar.buddhi](https://avatars.discourse-cdn.com/v4/letter/s/e480ec/32.png) [@sagar.buddhi](https://discuss.elastic.co/u/sagar.buddhi)\
**Post date:** [December 3, 2018, 1:28am UTC](https://discuss.elastic.co/t/sort-is-out-of-order-using-nested-filter/159070/1 "2018-12-03T01:28:32Z")

</div>

Hi All,  
I am trying to implement sorting by nested fields using this as reference ([https://www.elastic.co/guide/en/elasticsearch/guide/current/nested-sorting.html](https://www.elastic.co/guide/en/elasticsearch/guide/current/nested-sorting.html)) . but the results returned are not in sorted order. Could anyone assist please?

Basically in the below query I am trying to apply sorting to only between the date range "2018-12-08T10:00:00" to "2018-12-08T17:00:00". Below is the query.

 ![elasticsearch](https://us1.discourse-cdn.com/elastic/original/3X/e/5/e501dc168a316b21296a71e10b5d2614721dde21.png)

---

<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:** [December 31, 2018, 1:28am UTC](https://discuss.elastic.co/t/sort-is-out-of-order-using-nested-filter/159070/2 "2018-12-31T01:28:33Z")

</div>

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