# Sorting nested documents with inner\_hits not returning desired results. ES7.x

**URL:** <https://discuss.elastic.co/t/sorting-nested-documents-with-inner-hits-not-returning-desired-results-es7-x/232762>\
**Category:** Elasticsearch\
**Created:** [May 15, 2020, 6:35am UTC](https://discuss.elastic.co/t/sorting-nested-documents-with-inner-hits-not-returning-desired-results-es7-x/232762 "2020-05-15T06:35:21Z")\
**Posts on this page:** 1\
**Showing post:** 2

<div class="post-metadata">

**Author:** ![hkhan](https://avatars.discourse-cdn.com/v4/letter/h/9f8e36/32.png) [@hkhan](https://discuss.elastic.co/u/hkhan)\
**Post date:** [May 15, 2020, 2:28pm UTC](https://discuss.elastic.co/t/sorting-nested-documents-with-inner-hits-not-returning-desired-results-es7-x/232762/2 "2020-05-15T14:28:16Z")

</div>

I ran into an old post which perfectly describes the scenario I am facing. It was answered as not supported by ES as of Oct 2015. I am wondering if it's still not supported? If it isn't, I can't use Nested approach and will have to consider parent/child. I have to eventually filter nested objects and sort them by different nested fields.

This is the old post answered as not supported as of Oct 2015:

> [@Nested objects, hits, inner hits and sorting](https://discuss.elastic.co/t/nested-objects-hits-inner-hits-and-sorting/32565):
>
> As an example imagine Mapping OuterObject contains nested NestedObject. Data OuterObject1 contains NestedObject1, NestedObject2 OuterObject2 contains NestedObject3, NestedObject4 Desired Results (using a nested filter) 4 hits OuterObject1 and NestedObject1 OuterObject1 and NestedObject2 OuterObject2 and NestedObject3 OuterObject2 and NestedObject4 If I use inner hits then the results look like this OuterObject1, inner\_hits = NestedObject1, NestedObject2 OuterObject2, inner\_hits = Nes…

---

_[View the full topic](https://discuss.elastic.co/t/sorting-nested-documents-with-inner-hits-not-returning-desired-results-es7-x/232762)._
