public void readFrom(StreamInput in) throws IOException {
    super.readFrom(in);

    querySourceUnsafe = false;
    querySourceOffset = 0;
    querySourceLength = in.readVInt();
    querySource = new byte[querySourceLength];
    in.readFully(querySource);

    if (in.readBoolean()) {
      queryParserName = in.readUTF();
    }

    if (in.readBoolean()) {
      routing = in.readUTF();
    }

    int size = in.readVInt();
    if (size == 0) {
      types = Strings.EMPTY_ARRAY;
    } else {
      types = new String[size];
      for (int i = 0; i < size; i++) {
        types[i] = in.readUTF();
      }
    }
  }
  public void writeTo(StreamOutput out) throws IOException {
    super.writeTo(out);

    out.writeVInt(querySourceLength);
    out.writeBytes(querySource, querySourceOffset, querySourceLength);

    if (queryParserName == null) {
      out.writeBoolean(false);
    } else {
      out.writeBoolean(true);
      out.writeUTF(queryParserName);
    }
    if (routing == null) {
      out.writeBoolean(false);
    } else {
      out.writeBoolean(true);
      out.writeUTF(routing);
    }

    out.writeVInt(types.length);
    for (String type : types) {
      out.writeUTF(type);
    }
  }
 /** Should the listener be called on a separate thread if needed. */
 @Override
 public DeleteByQueryRequest listenerThreaded(boolean threadedListener) {
   super.listenerThreaded(threadedListener);
   return this;
 }