@@ -168,19 +168,21 @@ public IndexRequest(@Nullable ShardId shardId, StreamInput in) throws IOExceptio
168168 routing = in .readOptionalString ();
169169 final ESONFlat structuredSource ;
170170 final int originalSourceSize ;
171+ final BytesReference source ;
171172 if (in .getTransportVersion ().onOrAfter (TransportVersions .STRUCTURED_SOURCE )) {
172173 if (in .readBoolean ()) {
173174 originalSourceSize = in .readVInt ();
174175 structuredSource = new ESONFlat (in );
176+ source = null ;
175177 } else {
176- BytesReference source = in .readBytesReference ();
177- structuredSource = null ;
178+ source = in .readBytesReference ();
178179 originalSourceSize = source .length ();
180+ structuredSource = null ;
179181 }
180182 } else {
181- BytesReference source = in .readBytesReference ();
182- structuredSource = null ;
183+ source = in .readBytesReference ();
183184 originalSourceSize = source .length ();
185+ structuredSource = null ;
184186 }
185187 opType = OpType .fromId (in .readByte ());
186188 version = in .readLong ();
@@ -196,7 +198,7 @@ public IndexRequest(@Nullable ShardId shardId, StreamInput in) throws IOExceptio
196198 } else {
197199 contentType = null ;
198200 }
199- modernSource = new ModernSource (contentType , originalSourceSize , structuredSource );
201+ modernSource = new ModernSource (source , contentType , originalSourceSize , structuredSource );
200202 ifSeqNo = in .readZLong ();
201203 ifPrimaryTerm = in .readVLong ();
202204 requireAlias = in .readBoolean ();
0 commit comments