# Sorting by nested values in Javascript (Node.js)

**URL:** <https://discuss.elastic.co/t/sorting-by-nested-values-in-javascript-node-js/129171>\
**Category:** Elasticsearch\
**Created:** [April 23, 2018, 7:39pm UTC](https://discuss.elastic.co/t/sorting-by-nested-values-in-javascript-node-js/129171 "2018-04-23T19:39:40Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![YeeP](https://avatars.discourse-cdn.com/v4/letter/y/41988e/32.png) [@YeeP](https://discuss.elastic.co/u/YeeP)\
**Post date:** [April 23, 2018, 7:39pm UTC](https://discuss.elastic.co/t/sorting-by-nested-values-in-javascript-node-js/129171/1 "2018-04-23T19:39:40Z")

</div>

I have a sort that works great in Kibana, but cannot seem to get it to work with the Node.js client. Can anyone tell me how I can convert this to something that node will understand?

```
    GET sev_incidents/_search
{
   "query" : {
      "term" : { "open" : true }
   },
   "sort" : [
       {
          "update.submission_timestamp" : {
             "mode" : "max",
             "order" : "desc",
             "nested": {
                "path": "update"
             }
          }
       }
    ]
}

```

The api for search (what I am using this sort in) [API Reference | Elasticsearch JavaScript Client [8.11] | Elastic](https://www.elastic.co/guide/en/elasticsearch/client/javascript-api/current/api-reference.html#api-search)  
Lists "sort"' description as:

> String, String, Boolean — A comma-separated list of : pairs

Any suggestions on how to transcribe this sort into something that fits that criteria would be much appreciated.

---

<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:** [May 21, 2018, 7:39pm UTC](https://discuss.elastic.co/t/sorting-by-nested-values-in-javascript-node-js/129171/2 "2018-05-21T19:39:42Z")

</div>

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