From 0e30e268143728d4ee1f7531013ba2b786ed2217 Mon Sep 17 00:00:00 2001 From: Kosuke Suzuki <42459424+suzuki764@users.noreply.github.com> Date: Mon, 25 Nov 2024 01:37:03 +0900 Subject: [PATCH] Implement SortOptionsVariant in FieldSort (#1323) * Implement SortOptionsVariant in FieldSort Signed-off-by: Kosuke Suzuki * Add change log Signed-off-by: Kosuke Suzuki --------- Signed-off-by: Kosuke Suzuki (cherry picked from commit f9540f7829af91b740f6e67dc807a1df5d3ff497) --- CHANGELOG.md | 1 + .../opensearch/client/opensearch/_types/FieldSort.java | 10 +++++++++- 2 files changed, 10 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 74bb55d0b5..6fac4df4ba 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -17,6 +17,7 @@ Inspired from [Keep a Changelog](https://keepachangelog.com/en/1.0.0/) ### Fixed - Fixed `IcuCollationDecomposition`'s variants to align with those supported by OpenSearch ([#]()) - Fixed don't invoke the mapper's serialize method for the RangeQuery JsonData raw value [#1309](https://github.com/opensearch-project/opensearch-java/pull/1309) +- Fixed an issue where `FieldSort` was not implementing `SortOptionsVariant` ([#1323](https://github.com/opensearch-project/opensearch-java/pull/1323)) ### Security diff --git a/java-client/src/main/java/org/opensearch/client/opensearch/_types/FieldSort.java b/java-client/src/main/java/org/opensearch/client/opensearch/_types/FieldSort.java index b25f46697f..80de282ada 100644 --- a/java-client/src/main/java/org/opensearch/client/opensearch/_types/FieldSort.java +++ b/java-client/src/main/java/org/opensearch/client/opensearch/_types/FieldSort.java @@ -49,7 +49,7 @@ // typedef: _types.FieldSort @JsonpDeserializable -public class FieldSort implements PlainJsonSerializable { +public class FieldSort implements SortOptionsVariant, PlainJsonSerializable { // Single key dictionary private final String field; @@ -94,6 +94,14 @@ public static FieldSort of(Function> fn) { return fn.apply(new Builder()).build(); } + /** + * SortOptions variant kind. + */ + @Override + public SortOptions.Kind _sortOptionsKind() { + return SortOptions.Kind.Field; + } + /** * Required - The target field */