@Override public void writeTo(StreamOutput out) throws IOException { super.writeTo(out); out.writeByte(percolatorTypeId); out.writeVLong(requestedSize); out.writeVLong(count); out.writeVInt(matches.length); for (BytesRef match : matches) { out.writeBytesRef(match); } out.writeVLong(scores.length); for (float score : scores) { out.writeFloat(score); } out.writeVInt(hls.size()); for (Map<String, HighlightField> hl : hls) { out.writeVInt(hl.size()); for (Map.Entry<String, HighlightField> entry : hl.entrySet()) { out.writeString(entry.getKey()); entry.getValue().writeTo(out); } } out.writeOptionalStreamable(aggregations); if (pipelineAggregators == null) { out.writeBoolean(false); } else { out.writeBoolean(true); out.writeVInt(pipelineAggregators.size()); for (PipelineAggregator pipelineAggregator : pipelineAggregators) { out.writeBytesReference(pipelineAggregator.type().stream()); pipelineAggregator.writeTo(out); } } }
@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 writeTo(StreamOutput out) throws IOException { super.writeTo(out); out.writeByte(stage.value()); stats.writeTo(out); out.writeOptionalString(nodeId); out.writeOptionalString(failure); }
@Override public void writeTo(StreamOutput out) throws IOException { super.writeTo(out); out.writeVInt(fieldStats.size()); for (Map.Entry<String, FieldStats<?>> entry : fieldStats.entrySet()) { out.writeString(entry.getKey()); entry.getValue().writeTo(out); } }
@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; } }