Sort: FieldSort not implement SortOptionsVariant

Versions (relevant - OpenSearch/Dashboard/Server OS/Browser):

opensearch-java:2.10.4

Describe the issue:

When we want to sort a request, FieldSort doesn’t implement SortOptionVariant, so we cannot use it in SearchRequest with SortOptionsBuilders

SearchRequest.Builder searchRequest = new SearchRequest.Builder()
.sort(SortOptionsBuilders.field().field(“lastName”).order(SortOrder.Desc).build()._toSortOptions());

or

SearchRequest.Builder searchRequest = new SearchRequest.Builder()
.sort(FieldSort.of(s →
s.field(“lastName”).order(SortOrder.valueOf(request.sort_direction.name().toUpperCase())))._toSortOptions());

._toSortOptions() not available

However ScoreSort, GeoDistanceSort and ScriptSort implement SortOptionVariant

Configuration:

Relevant Logs or Screenshots:

Hi @Brun ,

It looks like a bug, could you please open an issue here [1]?
Thank you.

[1] Issues · opensearch-project/opensearch-java · GitHub

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