SortField in NEST 7.0 alpha 2 with Elasticsearch 7.1


I recently upgraded elasticsearch to 7.1 and NEST to version 7.0 alpha 2 in my existing .NET core based application.

I am generating search request where I am using SortField class to specify field to perform sorting on.

It was working fine with version 6.X of both elasticsearch and NEST but now after version upgrade I am getting error where I am using SortField class.

var sortField = new SortField();

Error message is "The type or namespace name 'SortField' could not be found"

Please help me out in resolving issue or let me know alternative way to achieve it.

FYI. I am using SortField instead of SortDescriptor in order to specify UnmappedType.

Thank you,

In 7.x, the types have been renamed to FieldSort FieldSortDescriptor<T> and IFieldSort to align the sort type naming conventions to *Sort.

If you change the type name to FieldSort in 7.x, I believe that is the only change you'll need to make.

1 Like

Yes. You are correct. Changing SortField to FieldSort did worked.

Thank you.

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