@Override
 public void readFrom(StreamInput in) throws IOException {
   super.readFrom(in);
   replicationType = ReplicationType.fromId(in.readByte());
   consistencyLevel = WriteConsistencyLevel.fromId(in.readByte());
   timeout = TimeValue.readTimeValue(in);
   index = in.readString();
 }
 @Override
 public void readFrom(StreamInput in) throws IOException {
   super.readFrom(in);
   sourceNodeId = in.readString();
   transferId = new UUID(in.readLong(), in.readLong());
   currentPos = in.readVInt();
   content = in.readBytesReference();
   isLast = in.readBoolean();
 }
 @Override
 public void readFrom(StreamInput in) throws IOException {
   super.readFrom(in);
   index = in.readString();
   shardId = in.readInt();
   timeout = TimeValue.readTimeValue(in);
   // no need to pass threading over the network, they are always false when coming throw a thread
   // pool
 }
 @Override
 public void readFrom(StreamInput in) throws IOException {
   super.readFrom(in);
   int size = in.readVInt();
   for (int i = 0; i < size; i++) {
     SearchRequest request = new SearchRequest();
     request.readFrom(in);
     requests.add(request);
   }
 }
 @Override
 public void readFrom(StreamInput in) throws IOException {
   super.readFrom(in);
   taskId = TaskId.readFromStream(in);
   parentTaskId = TaskId.readFromStream(in);
   nodesIds = in.readStringArray();
   actions = in.readStringArray();
   if (in.readBoolean()) {
     timeout = TimeValue.readTimeValue(in);
   }
 }
 @Override
 public void readFrom(StreamInput in) throws IOException {
   super.readFrom(in);
   if (in.readBoolean()) {
     shardId = ShardId.readShardId(in);
   } else {
     shardId = null;
   }
   consistencyLevel = WriteConsistencyLevel.fromId(in.readByte());
   timeout = TimeValue.readTimeValue(in);
   index = in.readString();
 }
  @Override
  public void readFrom(StreamInput in) throws IOException {
    super.readFrom(in);
    preference = in.readOptionalString();
    refresh = in.readBoolean();
    realtime = in.readBoolean();

    int size = in.readVInt();
    items = new ArrayList<>(size);
    for (int i = 0; i < size; i++) {
      items.add(Item.readItem(in));
    }
  }
  @Override
  public void readFrom(StreamInput in) throws IOException {
    super.readFrom(in);
    preference = in.readOptionalString();
    refresh = in.readBoolean();
    byte realtime = in.readByte();
    if (realtime == 0) {
      this.realtime = false;
    } else if (realtime == 1) {
      this.realtime = true;
    }
    ignoreErrorsOnGeneratedFields = in.readBoolean();

    int size = in.readVInt();
    items = new ArrayList<>(size);
    for (int i = 0; i < size; i++) {
      items.add(Item.readItem(in));
    }
  }
 @Override
 public void readFrom(StreamInput in) throws IOException {
   super.readFrom(in);
   requests = in.readStreamableList(SearchTemplateRequest::new);
 }