# Nested object in sort

**URL:** <https://discuss.elastic.co/t/nested-object-in-sort/121003>\
**Category:** Elasticsearch\
**Created:** [February 22, 2018, 7:49am UTC](https://discuss.elastic.co/t/nested-object-in-sort/121003 "2018-02-22T07:49:12Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![vicariouskp](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/vicariouskp/32/142942_2.png) [@vicariouskp](https://discuss.elastic.co/u/vicariouskp)\
**Post date:** [February 22, 2018, 7:49am UTC](https://discuss.elastic.co/t/nested-object-in-sort/121003/1 "2018-02-22T07:49:12Z")

</div>

Hello, I'm trying to write in c# using Nest 6.0 version code provided here: [https://www.elastic.co/guide/en/elasticsearch/reference/current/search-request-sort.html](https://www.elastic.co/guide/en/elasticsearch/reference/current/search-request-sort.html)

```auto
POST /_search
{
   "query" : {
      "term" : { "product" : "chocolate" }
   },
   "sort" : [
       {
          "offer.price" : {
             "mode" : "avg",
             "order" : "asc",
             "nested": {
                "path": "offer",
                "filter": {
                   "term" : { "offer.color" : "blue" }
                }
             }
          }
       }
    ]
}

```

How can write this nested object in c#?  
The only thing that I found in the library for the SortDescriptor object is NestedPath() and NestedFilter(), unfortunatelly both of them are deprecated:

#! Deprecation: [nested\_path] has been deprecated in favor of the [nested] parameter  
#! Deprecation: [nested\_filter] has been deprecated in favour for the [nested] parameter

---

<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:** [March 22, 2018, 7:49am UTC](https://discuss.elastic.co/t/nested-object-in-sort/121003/2 "2018-03-22T07:49:37Z")

</div>

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