# Sort on multiple nested values

**URL:** https://discuss.elastic.co/t/sort-on-multiple-nested-values/123587
**Category:** Elasticsearch
**Created:** [March 12, 2018, 3:54pm UTC](https://discuss.elastic.co/t/sort-on-multiple-nested-values/123587 "2018-03-12T15:54:16Z")
**Posts on this page:** 2
**Page:** 1

<div class="post-metadata">

### Author: ![k7n2](https://avatars.discourse-cdn.com/v4/letter/k/a183cd/32.png) [@k7n2](https://discuss.elastic.co/u/k7n2)
#### Post date: [March 12, 2018, 3:54pm UTC](https://discuss.elastic.co/t/sort-on-multiple-nested-values/123587/1 "2018-03-12T15:54:16Z")

</div>

Hi, how could I sort based on multiple values?

This works fine:

```
POST testindex/default/_search
{
 "sort": [{
 "product.rating" : {
         "nested_path": "product", 
         "order" : "asc",
         "nested_filter": [{
               "term" : { "product.name": "hummer" }
         }]
      }
   }
]}

```

But this only sort on "lobster":

```
POST testindex/default/_search
{
 "sort": [{
 "product.rating" : {
         "nested_path": "product", 
         "order" : "asc",
         "nested_filter": [{
               "term" : { "product.name": "lobster" }
         }]
      }
   },
{
 "product.rating" : {
         "nested_path": "product", 
         "order" : "asc",
         "nested_filter": [{
               "term" : { "product.name": "salmon" }
         }]
      }
   }
]}
```

---

<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: [April 9, 2018, 3:54pm UTC](https://discuss.elastic.co/t/sort-on-multiple-nested-values/123587/2 "2018-04-09T15:54:29Z")

</div>

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