I am using ElasticSearch Nest Fluent DSL and cant seem to figure out how to create a list of Sorts that the .Sort() accepts.
I have an array of sorts and i want to convert them to work with Nest a bit like you can do with Filters:
new List<Func<QueryContainerDescriptor, QueryContainer>>();
Any ideas?
I thought it would be something like:
var testSort = new List<ISort>();
foreach (var option in queryBuilder.Sort)
{
testSort.Add(new FieldSort { Field = option.Key, Order = option.SortOrder == "ASC" ? SortOrder.Ascending : SortOrder.Descending });
}
but .Sort() doesnt except it.
Thanks
Figured it out:
Then in the query just add:
.Sort(sortList)