@Override
  public void writeTo(StreamOutput out) throws IOException {
    out.writeString(index);
    out.writeVInt(numberOfShards);
    out.writeVInt(numberOfReplicas);
    out.writeVInt(activePrimaryShards);
    out.writeVInt(activeShards);
    out.writeVInt(relocatingShards);
    out.writeVInt(initializingShards);
    out.writeVInt(unassignedShards);
    out.writeByte(status.value());

    out.writeVInt(shards.size());
    for (ClusterShardHealth shardHealth : this) {
      shardHealth.writeTo(out);
    }

    out.writeVInt(validationFailures.size());
    for (String failure : validationFailures) {
      out.writeString(failure);
    }
  }
  @Override
  public void writeTo(StreamOutput out) throws IOException {
    out.writeUTF(clusterName);
    out.writeVInt(activePrimaryShards);
    out.writeVInt(activeShards);
    out.writeVInt(relocatingShards);
    out.writeVInt(initializingShards);
    out.writeVInt(unassignedShards);
    out.writeVInt(numberOfNodes);
    out.writeVInt(numberOfDataNodes);
    out.writeByte(status.value());
    out.writeVInt(indices.size());
    for (ClusterIndexHealth indexHealth : this) {
      indexHealth.writeTo(out);
    }
    out.writeBoolean(timedOut);

    out.writeVInt(validationFailures.size());
    for (String failure : validationFailures) {
      out.writeUTF(failure);
    }
  }