From 02e3c56a5d8279e1339a9f4dc2e1f7754d3ad699 Mon Sep 17 00:00:00 2001 From: Rishabh Maurya Date: Thu, 11 Apr 2024 16:57:07 -0700 Subject: [PATCH] Replace the right version to fix backward compatibility introduced with DerivedFields feature (#13168) Signed-off-by: Rishabh Maurya --- .../org/opensearch/search/builder/SearchSourceBuilder.java | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/server/src/main/java/org/opensearch/search/builder/SearchSourceBuilder.java b/server/src/main/java/org/opensearch/search/builder/SearchSourceBuilder.java index 77d5567b924eb..182350c22f697 100644 --- a/server/src/main/java/org/opensearch/search/builder/SearchSourceBuilder.java +++ b/server/src/main/java/org/opensearch/search/builder/SearchSourceBuilder.java @@ -289,7 +289,7 @@ public SearchSourceBuilder(StreamInput in) throws IOException { if (in.getVersion().onOrAfter(Version.V_2_13_0)) { includeNamedQueriesScore = in.readOptionalBoolean(); } - if (in.getVersion().onOrAfter(Version.V_3_0_0)) { + if (in.getVersion().onOrAfter(Version.V_2_14_0)) { if (in.readBoolean()) { derivedFieldsObject = in.readMap(); } @@ -365,7 +365,7 @@ public void writeTo(StreamOutput out) throws IOException { if (out.getVersion().onOrAfter(Version.V_2_13_0)) { out.writeOptionalBoolean(includeNamedQueriesScore); } - if (out.getVersion().onOrAfter(Version.V_3_0_0)) { + if (out.getVersion().onOrAfter(Version.V_2_14_0)) { boolean hasDerivedFieldsObject = derivedFieldsObject != null; out.writeBoolean(hasDerivedFieldsObject); if (hasDerivedFieldsObject) {