# Multiple field Sorting after bucket aggregation in Nest elastic search C#

**URL:** <https://discuss.elastic.co/t/multiple-field-sorting-after-bucket-aggregation-in-nest-elastic-search-c/125025>\
**Category:** Elasticsearch\
**Created:** [March 21, 2018, 3:55pm UTC](https://discuss.elastic.co/t/multiple-field-sorting-after-bucket-aggregation-in-nest-elastic-search-c/125025 "2018-03-21T15:55:04Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![developer\_ak](https://avatars.discourse-cdn.com/v4/letter/d/3bc359/32.png) [@developer\_ak](https://discuss.elastic.co/u/developer_ak)\
**Post date:** [March 21, 2018, 3:55pm UTC](https://discuss.elastic.co/t/multiple-field-sorting-after-bucket-aggregation-in-nest-elastic-search-c/125025/1 "2018-03-21T15:55:04Z")

</div>

Hi All

I am trying to write sorting on multiple fields after performing bucketing aggregation. When I upgraded to Nest 6.0.0.0 C# I am getting an error saying that the following I need to convert my descriptor to IPromise\<IList\>.  
I am not exactly sure how to provide this input.  
My function snippet is something like this :

var sortList = new List() ;  
foreach (SortCriteria sc in sortCriterias) {

```
        switch (sc.SortMode) {
           case SortMode.Asc:
                 sortList.Add(new SortField { Field = "Test", Order = SortOrder.Ascending });
              break;
           case SortMode.Desc:
                 sortList.Add(new SortField { Field = "Test2", Order = SortOrder.Descending });
              break;
        }
     }
     return sortList; --> Somehow I need to convert this list to IPromise<IList<ISort>>

```

Can someone help me out in how to write this multiple field sort

---

<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 18, 2018, 3:55pm UTC](https://discuss.elastic.co/t/multiple-field-sorting-after-bucket-aggregation-in-nest-elastic-search-c/125025/2 "2018-04-18T15:55:15Z")

</div>

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