[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 <nknize@apache.org>
This commit is contained in:
Nick Knize 2021-05-26 18:16:23 -05:00 committed by Nicholas Walter Knize
parent 053ed7b66d
commit 403c511c17
No known key found for this signature in database
GPG Key ID: 51F0CC22F625308A
1 changed files with 5 additions and 1 deletions

View File

@ -102,7 +102,11 @@ public class MainResponse extends ActionResponse implements ToXContentObject {
@Override
public void writeTo(StreamOutput out) throws IOException {
out.writeString(nodeName);
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);