|
@@ -29,8 +29,7 @@ public class MainResponse extends ActionResponse implements ToXContentObject {
|
|
|
|
|
|
private String nodeName;
|
|
|
private Version version;
|
|
|
- private IndexVersion indexVersion;
|
|
|
- private TransportVersion transportVersion;
|
|
|
+ private String luceneVersion;
|
|
|
private ClusterName clusterName;
|
|
|
private String clusterUuid;
|
|
|
private Build build;
|
|
@@ -41,26 +40,35 @@ public class MainResponse extends ActionResponse implements ToXContentObject {
|
|
|
super(in);
|
|
|
nodeName = in.readString();
|
|
|
version = Version.readVersion(in);
|
|
|
- indexVersion = in.getTransportVersion().onOrAfter(TransportVersion.V_8_500_031) ? IndexVersion.readVersion(in) : null;
|
|
|
- transportVersion = in.getTransportVersion().onOrAfter(TransportVersion.V_8_500_019) ? TransportVersion.readVersion(in) : null;
|
|
|
+
|
|
|
+ // Index version and transport version were briefly included in the main response, but
|
|
|
+ // removed before the 8.9.0 release. Reading code remains here (throwing away the values)
|
|
|
+ // for those versions until the new format has propagated through serverless. Additionally,
|
|
|
+ // the lucene version was previously read by inferring from either Version or IndexVersion.
|
|
|
+ // Now the lucene version is read explicitly.
|
|
|
+ if (in.getTransportVersion().onOrAfter(TransportVersion.V_8_500_037)) {
|
|
|
+ luceneVersion = in.readString();
|
|
|
+ } else {
|
|
|
+ if (in.getTransportVersion().onOrAfter(TransportVersion.V_8_500_031)) {
|
|
|
+ luceneVersion = IndexVersion.readVersion(in).luceneVersion().toString();
|
|
|
+ } else if (version.before(Version.V_8_10_0)) {
|
|
|
+ luceneVersion = IndexVersion.fromId(version.id).luceneVersion().toString();
|
|
|
+ } else {
|
|
|
+ luceneVersion = "unknown";
|
|
|
+ }
|
|
|
+ if (in.getTransportVersion().onOrAfter(TransportVersion.V_8_500_019)) {
|
|
|
+ TransportVersion.readVersion(in);
|
|
|
+ }
|
|
|
+ }
|
|
|
clusterName = new ClusterName(in);
|
|
|
clusterUuid = in.readString();
|
|
|
build = Build.readBuild(in);
|
|
|
}
|
|
|
|
|
|
- public MainResponse(
|
|
|
- String nodeName,
|
|
|
- Version version,
|
|
|
- IndexVersion indexVersion,
|
|
|
- TransportVersion transportVersion,
|
|
|
- ClusterName clusterName,
|
|
|
- String clusterUuid,
|
|
|
- Build build
|
|
|
- ) {
|
|
|
+ public MainResponse(String nodeName, Version version, String luceneVersion, ClusterName clusterName, String clusterUuid, Build build) {
|
|
|
this.nodeName = nodeName;
|
|
|
this.version = version;
|
|
|
- this.indexVersion = indexVersion;
|
|
|
- this.transportVersion = transportVersion;
|
|
|
+ this.luceneVersion = luceneVersion;
|
|
|
this.clusterName = clusterName;
|
|
|
this.clusterUuid = clusterUuid;
|
|
|
this.build = build;
|
|
@@ -74,12 +82,8 @@ public class MainResponse extends ActionResponse implements ToXContentObject {
|
|
|
return version;
|
|
|
}
|
|
|
|
|
|
- public IndexVersion getIndexVersion() {
|
|
|
- return indexVersion;
|
|
|
- }
|
|
|
-
|
|
|
- public TransportVersion getTransportVersion() {
|
|
|
- return transportVersion;
|
|
|
+ public String getLuceneVersion() {
|
|
|
+ return luceneVersion;
|
|
|
}
|
|
|
|
|
|
public ClusterName getClusterName() {
|
|
@@ -98,27 +102,27 @@ public class MainResponse extends ActionResponse implements ToXContentObject {
|
|
|
public void writeTo(StreamOutput out) throws IOException {
|
|
|
out.writeString(nodeName);
|
|
|
Version.writeVersion(version, out);
|
|
|
- if (out.getTransportVersion().onOrAfter(TransportVersion.V_8_500_031)) {
|
|
|
- IndexVersion.writeVersion(indexVersion, out);
|
|
|
- }
|
|
|
- if (out.getTransportVersion().onOrAfter(TransportVersion.V_8_500_019)) {
|
|
|
- TransportVersion.writeVersion(transportVersion, out);
|
|
|
+
|
|
|
+ // Index version and transport version were briefly included in the main response, but
|
|
|
+ // removed before the 8.9.0 release. Writing code remains here (writing the latest versions)
|
|
|
+ // for those versions until the new format has propagated through serverless. Additionally,
|
|
|
+ // the lucene version was previously inferred from either Version or IndexVersion.
|
|
|
+ // Now the lucene version is written explicitly.
|
|
|
+ if (out.getTransportVersion().onOrAfter(TransportVersion.V_8_500_037)) {
|
|
|
+ out.writeString(luceneVersion);
|
|
|
+ } else {
|
|
|
+ if (out.getTransportVersion().onOrAfter(TransportVersion.V_8_500_031)) {
|
|
|
+ IndexVersion.writeVersion(IndexVersion.current(), out);
|
|
|
+ }
|
|
|
+ if (out.getTransportVersion().onOrAfter(TransportVersion.V_8_500_019)) {
|
|
|
+ TransportVersion.writeVersion(TransportVersion.current(), out);
|
|
|
+ }
|
|
|
}
|
|
|
clusterName.writeTo(out);
|
|
|
out.writeString(clusterUuid);
|
|
|
Build.writeBuild(build, out);
|
|
|
}
|
|
|
|
|
|
- private String getLuceneVersion() {
|
|
|
- if (indexVersion != null) {
|
|
|
- return indexVersion.luceneVersion().toString();
|
|
|
- } else if (version.before(Version.V_8_10_0)) {
|
|
|
- return IndexVersion.fromId(version.id).luceneVersion().toString();
|
|
|
- } else {
|
|
|
- return "unknown";
|
|
|
- }
|
|
|
- }
|
|
|
-
|
|
|
@Override
|
|
|
public XContentBuilder toXContent(XContentBuilder builder, Params params) throws IOException {
|
|
|
builder.startObject();
|
|
@@ -132,11 +136,9 @@ public class MainResponse extends ActionResponse implements ToXContentObject {
|
|
|
.field("build_hash", build.hash())
|
|
|
.field("build_date", build.date())
|
|
|
.field("build_snapshot", build.isSnapshot())
|
|
|
- .field("lucene_version", getLuceneVersion())
|
|
|
- .field("index_version", indexVersion != null ? indexVersion.toString() : "unknown")
|
|
|
+ .field("lucene_version", luceneVersion)
|
|
|
.field("minimum_wire_compatibility_version", version.minimumCompatibilityVersion().toString())
|
|
|
.field("minimum_index_compatibility_version", version.minimumIndexCompatibilityVersion().toString())
|
|
|
- .field("transport_version", transportVersion != null ? transportVersion.toString() : "unknown")
|
|
|
.endObject();
|
|
|
builder.field("tagline", "You Know, for Search");
|
|
|
builder.endObject();
|
|
@@ -170,16 +172,7 @@ public class MainResponse extends ActionResponse implements ToXContentObject {
|
|
|
response.version = Version.fromString(
|
|
|
((String) value.get("number")).replace("-SNAPSHOT", "").replaceFirst("-(alpha\\d+|beta\\d+|rc\\d+)", "")
|
|
|
);
|
|
|
-
|
|
|
- String indexVersion = (String) value.get("index_version");
|
|
|
- response.indexVersion = indexVersion != null && indexVersion.equals("unknown") == false
|
|
|
- ? IndexVersion.fromId(Integer.parseInt(indexVersion))
|
|
|
- : null;
|
|
|
-
|
|
|
- String transportVersion = (String) value.get("transport_version");
|
|
|
- response.transportVersion = transportVersion != null && transportVersion.equals("unknown") == false
|
|
|
- ? TransportVersion.fromString(transportVersion)
|
|
|
- : null;
|
|
|
+ response.luceneVersion = ((String) value.get("lucene_version"));
|
|
|
}, (parser, context) -> parser.map(), new ParseField("version"));
|
|
|
}
|
|
|
|
|
@@ -198,8 +191,7 @@ public class MainResponse extends ActionResponse implements ToXContentObject {
|
|
|
MainResponse other = (MainResponse) o;
|
|
|
return Objects.equals(nodeName, other.nodeName)
|
|
|
&& Objects.equals(version, other.version)
|
|
|
- && Objects.equals(indexVersion, other.indexVersion)
|
|
|
- && Objects.equals(transportVersion, other.transportVersion)
|
|
|
+ && Objects.equals(luceneVersion, other.luceneVersion)
|
|
|
&& Objects.equals(clusterUuid, other.clusterUuid)
|
|
|
&& Objects.equals(build, other.build)
|
|
|
&& Objects.equals(clusterName, other.clusterName);
|
|
@@ -207,7 +199,7 @@ public class MainResponse extends ActionResponse implements ToXContentObject {
|
|
|
|
|
|
@Override
|
|
|
public int hashCode() {
|
|
|
- return Objects.hash(nodeName, version, indexVersion, transportVersion, clusterUuid, build, clusterName);
|
|
|
+ return Objects.hash(nodeName, version, luceneVersion, clusterUuid, build, clusterName);
|
|
|
}
|
|
|
|
|
|
@Override
|
|
@@ -218,10 +210,8 @@ public class MainResponse extends ActionResponse implements ToXContentObject {
|
|
|
+ '\''
|
|
|
+ ", version="
|
|
|
+ version
|
|
|
- + ", indexVersion="
|
|
|
- + indexVersion
|
|
|
- + ", transportVersion="
|
|
|
- + transportVersion
|
|
|
+ + ", luceneVersion="
|
|
|
+ + luceneVersion
|
|
|
+ ", clusterName="
|
|
|
+ clusterName
|
|
|
+ ", clusterUuid='"
|