# Nested Sorting Contradictory Answers

**URL:** <https://discuss.elastic.co/t/nested-sorting-contradictory-answers/8811>\
**Category:** Elasticsearch\
**Created:** [August 22, 2012, 10:31am UTC](https://discuss.elastic.co/t/nested-sorting-contradictory-answers/8811 "2012-08-22T10:31:08Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![davrob](https://avatars.discourse-cdn.com/v4/letter/d/d78d45/32.png) [@davrob](https://discuss.elastic.co/u/davrob)\
**Post date:** [August 22, 2012, 10:31am UTC](https://discuss.elastic.co/t/nested-sorting-contradictory-answers/8811/1 "2012-08-22T10:31:08Z")

</div>

Hi,

Looking through the forums, Shay seems to have given two different answers  
to the same question:

[http://elasticsearch-users.115913.n3.nabble.com/Sort-on-a-deeply-nested-field-tp3518043p3522355.html](http://elasticsearch-users.115913.n3.nabble.com/Sort-on-a-deeply-nested-field-tp3518043p3522355.html)

[http://elasticsearch-users.115913.n3.nabble.com/Sorting-by-an-nested-object-field-tp3590066p3591950.html](http://elasticsearch-users.115913.n3.nabble.com/Sorting-by-an-nested-object-field-tp3590066p3591950.html)

Has anyone got SINGLE VALUED - nested fields to sort properly?

- David.

--

---

<div class="post-metadata">

**Author:** ![davrob](https://avatars.discourse-cdn.com/v4/letter/d/d78d45/32.png) [@davrob](https://discuss.elastic.co/u/davrob)\
**Post date:** [August 22, 2012, 11:41am UTC](https://discuss.elastic.co/t/nested-sorting-contradictory-answers/8811/2 "2012-08-22T11:41:29Z")

</div>

Actually, looking more closely at the first thread, I have a similar  
structure to this:

{  
"name" : "Snoprinsessa Barbie",  
"items" : [  
{ "name" : "Faux fur-trimmed parka", "id" : 2 },  
{ "name" : "Stud Diamond Ring", " id " : 3 }  
]  
}

Any sorting I would want to do would be filtered to make the results  
single-valued.

i.e. a term filter with id=3, for the above example

Which I think is more like these examples:

[http://elasticsearch-users.115913.n3.nabble.com/Sort-on-nested-object-td3797238.html](http://elasticsearch-users.115913.n3.nabble.com/Sort-on-nested-object-td3797238.html)

[http://elasticsearch-users.115913.n3.nabble.com/sort-not-working-with-nested-query-in-elasticsearch-td3486125.html#a3486720](http://elasticsearch-users.115913.n3.nabble.com/sort-not-working-with-nested-query-in-elasticsearch-td3486125.html#a3486720)

- do I need a plugin for this or is it possible to use out-of-the-box  
sorting?

On Wednesday, August 22, 2012 11:31:08 AM UTC+1, davrob2 wrote:

> Hi,
> 
> Looking through the forums, Shay seems to have given two different answers  
> to the same question:
> 
> [http://elasticsearch-users.115913.n3.nabble.com/Sort-on-a-deeply-nested-field-tp3518043p3522355.html](http://elasticsearch-users.115913.n3.nabble.com/Sort-on-a-deeply-nested-field-tp3518043p3522355.html)
> 
> [http://elasticsearch-users.115913.n3.nabble.com/Sorting-by-an-nested-object-field-tp3590066p3591950.html](http://elasticsearch-users.115913.n3.nabble.com/Sorting-by-an-nested-object-field-tp3590066p3591950.html)
> 
> Has anyone got SINGLE VALUED - nested fields to sort properly?
> 
> - David.

--

---

<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 6, 2017, 3:15am UTC](https://discuss.elastic.co/t/nested-sorting-contradictory-answers/8811/3 "2017-07-06T03:15:30Z")

</div>


