From 403c511c1757b1e81990be601e8336338377a2aa Mon Sep 17 00:00:00 2001 From: Nick Knize Date: Wed, 26 May 2021 18:16:23 -0500 Subject: [PATCH] [BUG] fix MainResponse to spoof version number for legacy clients (#708) This commit changes MainResponse to spoof OpenSearch 1.x version numbers as Legacy version number 7.10.2 for legacy clients. Signed-off-by: Nicholas Walter Knize --- .../main/java/org/opensearch/action/main/MainResponse.java | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/server/src/main/java/org/opensearch/action/main/MainResponse.java b/server/src/main/java/org/opensearch/action/main/MainResponse.java index d3a54dec605..3b32bdea291 100644 --- a/server/src/main/java/org/opensearch/action/main/MainResponse.java +++ b/server/src/main/java/org/opensearch/action/main/MainResponse.java @@ -102,7 +102,11 @@ public class MainResponse extends ActionResponse implements ToXContentObject { @Override public void writeTo(StreamOutput out) throws IOException { out.writeString(nodeName); - Version.writeVersion(version, out); + if (out.getVersion().before(Version.V_1_0_0)) { + Version.writeVersion(LegacyESVersion.V_7_10_2, out); + } else { + Version.writeVersion(version, out); + } clusterName.writeTo(out); out.writeString(clusterUuid); Build.writeBuild(build, out);