|
32 | 32 |
|
33 | 33 | package org.opensearch.cluster.health; |
34 | 34 |
|
| 35 | +import org.opensearch.Version; |
35 | 36 | import org.opensearch.action.admin.cluster.health.ClusterHealthRequest; |
36 | 37 | import org.opensearch.cluster.metadata.IndexMetadata; |
37 | 38 | import org.opensearch.cluster.routing.IndexRoutingTable; |
@@ -306,7 +307,11 @@ public ClusterIndexHealth(final StreamInput in) throws IOException { |
306 | 307 | index = in.readString(); |
307 | 308 | numberOfShards = in.readVInt(); |
308 | 309 | numberOfReplicas = in.readVInt(); |
309 | | - numberOfSearchReplicas = in.readVInt(); |
| 310 | + if (in.getVersion().onOrAfter(Version.V_3_0_0)) { |
| 311 | + numberOfSearchReplicas = in.readVInt(); |
| 312 | + } else { |
| 313 | + numberOfSearchReplicas = 0; |
| 314 | + } |
310 | 315 | activePrimaryShards = in.readVInt(); |
311 | 316 | activeShards = in.readVInt(); |
312 | 317 | relocatingShards = in.readVInt(); |
@@ -409,7 +414,9 @@ public void writeTo(final StreamOutput out) throws IOException { |
409 | 414 | out.writeString(index); |
410 | 415 | out.writeVInt(numberOfShards); |
411 | 416 | out.writeVInt(numberOfReplicas); |
412 | | - out.writeVInt(numberOfSearchReplicas); |
| 417 | + if (out.getVersion().onOrAfter(Version.V_3_0_0)) { |
| 418 | + out.writeVInt(numberOfSearchReplicas); |
| 419 | + } |
413 | 420 | out.writeVInt(activePrimaryShards); |
414 | 421 | out.writeVInt(activeShards); |
415 | 422 | out.writeVInt(relocatingShards); |
|
0 commit comments