Sorting on Multiple Fields

前端 未结 5 1495
执笔经年
执笔经年 2021-01-04 19:31

Does Nest support sorting on multiple fields? For example, say I want to sort first by FieldA ascending and then by FieldB descending.

My current approach looks some

5条回答
  •  悲哀的现实
    2021-01-04 19:45

    You can use it like this. You also can use the names from your model.

       EsClient.Search(s => s
          .Query (qq=> {...})
          .Sort(sort => sort.OnField(s => s.Name).Descending())
          .Sort(sort => sort.OnField(s => s.Age).Descending())
        )
    

提交回复
热议问题