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 something like this:
searchDescriptor.Sort(s =>s.OnField("FieldA").Ascending().OnField("FieldB").Descending());
But the "FieldB".Descending() part seems to be the only sort option that is sent to elasticsearch.
Does anyone know if there is another way to accomplish this?
Multi-Level Sorting Using Sort Icons Select the column that you want to be sorted last (in this case, select the Sales data first – C1:C13). Click on the Data tab. In the Sort and Filter group, click on the Z to A sorting icon. This will sort the sales data from largest to smallest.
Multicolumn sorting allows you to sort the fields one after the other. For example, if a user has three different fields rendered in the pivot grid, then it is possible to sort like: OrderBy(field1). ThenBy(field2).
I recent version of Nest the correct way of sortin on multiple fileds would be:
.Sort(s => s
Field(f => f
.Field("FieldA")
.Order(SortOrder.Ascending)
)
.Field(f => f
.Field("FieldB")
.Order(SortOrder.Ascending)
)
);
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With