@Override
  public void writeTo(StreamOutput out) throws IOException {
    super.writeTo(out);
    out.writeFloat(minScore);

    out.writeBytesReference(querySource);

    out.writeVInt(types.length);
    for (String type : types) {
      out.writeString(type);
    }
    if (filteringAliases != null) {
      out.writeVInt(filteringAliases.length);
      for (String alias : filteringAliases) {
        out.writeString(alias);
      }
    } else {
      out.writeVInt(0);
    }
    out.writeVLong(nowInMillis);
  }
  @Override
  public void readFrom(StreamInput in) throws IOException {
    super.readFrom(in);
    minScore = in.readFloat();

    querySource = in.readBytesReference();

    int typesSize = in.readVInt();
    if (typesSize > 0) {
      types = new String[typesSize];
      for (int i = 0; i < typesSize; i++) {
        types[i] = in.readString();
      }
    }
    int aliasesSize = in.readVInt();
    if (aliasesSize > 0) {
      filteringAliases = new String[aliasesSize];
      for (int i = 0; i < aliasesSize; i++) {
        filteringAliases[i] = in.readString();
      }
    }
    nowInMillis = in.readVLong();
  }
 @Override
 public void writeTo(StreamOutput out) throws IOException {
   super.writeTo(out);
   out.writeBoolean(recovery);
   out.writeBoolean(snapshot);
 }
 @Override
 public void readFrom(StreamInput in) throws IOException {
   super.readFrom(in);
   recovery = in.readBoolean();
   snapshot = in.readBoolean();
 }