@Override public void writeTo(StreamOutput out) throws IOException { super.writeTo(out); out.writeOptionalString(type); out.writeOptionalString(id); out.writeOptionalString(routing); out.writeOptionalString(parent); if (out.getVersion().before(Version.V_6_0_0_alpha1_UNRELEASED)) { out.writeOptionalString(null); out.writeOptionalWriteable(null); } out.writeBytesReference(source); out.writeByte(opType.getId()); out.writeLong(version); out.writeByte(versionType.getValue()); out.writeOptionalString(pipeline); out.writeBoolean(isRetry); out.writeLong(autoGeneratedTimestamp); }
@Override public void readFrom(StreamInput in) throws IOException { super.readFrom(in); type = in.readOptionalString(); id = in.readOptionalString(); routing = in.readOptionalString(); parent = in.readOptionalString(); if (in.getVersion().before(Version.V_6_0_0_alpha1_UNRELEASED)) { in.readOptionalString(); // timestamp in.readOptionalWriteable(TimeValue::new); // ttl } source = in.readBytesReference(); opType = OpType.fromId(in.readByte()); version = in.readLong(); versionType = VersionType.fromValue(in.readByte()); pipeline = in.readOptionalString(); isRetry = in.readBoolean(); autoGeneratedTimestamp = in.readLong(); }