[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 GitHub
parent 141d6b4e86
commit c62884a1e9
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
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);
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);