Skip to content

Commit 47c4d4a

Browse files
committed
Fixes
1 parent 4ac2af0 commit 47c4d4a

File tree

1 file changed

+4
-3
lines changed

1 file changed

+4
-3
lines changed

server/src/main/java/org/elasticsearch/action/index/IndexRequest.java

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -170,8 +170,8 @@ public IndexRequest(@Nullable ShardId shardId, StreamInput in) throws IOExceptio
170170
final int originalSourceSize;
171171
if (in.getTransportVersion().onOrAfter(TransportVersions.STRUCTURED_SOURCE)) {
172172
if (in.readBoolean()) {
173-
structuredSource = new ESONFlat(in);
174173
originalSourceSize = in.readVInt();
174+
structuredSource = new ESONFlat(in);
175175
} else {
176176
BytesReference source = in.readBytesReference();
177177
structuredSource = null;
@@ -453,7 +453,8 @@ public ESONFlat structuredSource() {
453453
}
454454

455455
public Map<String, Object> sourceAsMap() {
456-
return ESONIndexed.fromFlat(modernSource.structuredSource());
456+
// TODO: Improve and remove need to do the bytes.
457+
return XContentHelper.convertToMap(modernSource.originalSourceBytes(), false, contentType).v2();
457458
}
458459

459460
/**
@@ -805,8 +806,8 @@ private void writeBody(StreamOutput out) throws IOException {
805806
if (out.getTransportVersion().onOrAfter(TransportVersions.STRUCTURED_SOURCE)) {
806807
out.writeBoolean(modernSource.isStructured());
807808
if (modernSource.isStructured()) {
808-
ESONFlat structuredSource = modernSource.structuredSource();
809809
out.writeVInt(modernSource.originalSourceSize());
810+
ESONFlat structuredSource = modernSource.structuredSource();
810811
out.writeBytesReference(structuredSource.getSerializedKeyBytes());
811812
out.writeBytesReference(structuredSource.values().data());
812813
} else {

0 commit comments

Comments
 (0)