@Override
 public void readFrom(StreamInput in) throws IOException {
   super.readFrom(in);
   stage = SnapshotIndexShardStage.fromValue(in.readByte());
   stats = SnapshotStats.readSnapshotStats(in);
   nodeId = in.readOptionalString();
   failure = in.readOptionalString();
 }
 @Override
 public void readFrom(StreamInput in) throws IOException {
   super.readFrom(in);
   final int size = in.readVInt();
   fieldStats = new HashMap<>(size);
   for (int i = 0; i < size; i++) {
     String key = in.readString();
     FieldStats value = FieldStats.readFrom(in);
     fieldStats.put(key, value);
   }
 }
 @Override
 public void readFrom(StreamInput in) throws IOException {
   super.readFrom(in);
   percolatorTypeId = in.readByte();
   requestedSize = in.readVInt();
   count = in.readVLong();
   matches = new BytesRef[in.readVInt()];
   for (int i = 0; i < matches.length; i++) {
     matches[i] = in.readBytesRef();
   }
   scores = new float[in.readVInt()];
   for (int i = 0; i < scores.length; i++) {
     scores[i] = in.readFloat();
   }
   int size = in.readVInt();
   for (int i = 0; i < size; i++) {
     int mSize = in.readVInt();
     Map<String, HighlightField> fields = new HashMap<>();
     for (int j = 0; j < mSize; j++) {
       fields.put(in.readString(), HighlightField.readHighlightField(in));
     }
     hls.add(fields);
   }
   aggregations = InternalAggregations.readOptionalAggregations(in);
   if (in.readBoolean()) {
     int pipelineAggregatorsSize = in.readVInt();
     List<SiblingPipelineAggregator> pipelineAggregators =
         new ArrayList<>(pipelineAggregatorsSize);
     for (int i = 0; i < pipelineAggregatorsSize; i++) {
       BytesReference type = in.readBytesReference();
       PipelineAggregator pipelineAggregator =
           PipelineAggregatorStreams.stream(type).readResult(in);
       pipelineAggregators.add((SiblingPipelineAggregator) pipelineAggregator);
     }
     this.pipelineAggregators = pipelineAggregators;
   }
 }