opensearch-java icon indicating copy to clipboard operation
opensearch-java copied to clipboard

[BUG] FieldSort not implement SortOptionsVariant

Open jbrun opened this issue 1 year ago • 1 comments

What is the bug?

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

How can one reproduce the bug?

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(ortOrder.Desc))._toSortOptions());

._toSortOptions() not available

However ScoreSort, GeoDistanceSort and ScriptSort implement SortOptionVariant

What is the expected behavior?

package org.opensearch.client.opensearch._types; public class FieldSort implements SortOptionsVariant, JsonpSerializable

What is your host/environment?

opensearch-java:2.10.4

jbrun avatar Jul 17 '24 13:07 jbrun

[Catch All Triage - 1, 2, 3]

dblock avatar Aug 05 '24 16:08 dblock