Skip to content

Commit 04684ed

Browse files
committed
Changes
1 parent 761ae27 commit 04684ed

File tree

2 files changed

+15
-4
lines changed

2 files changed

+15
-4
lines changed

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

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -952,7 +952,13 @@ public Index getConcreteWriteIndex(IndexAbstraction ia, ProjectMetadata project)
952952

953953
@Override
954954
public int route(IndexRouting indexRouting) {
955-
return indexRouting.indexShard(id, routing, contentType, source());
955+
// TODO: avoid materializing the source atm when not using extract from source. Extract from source can be changed to use structured
956+
// source.
957+
if (indexRouting instanceof IndexRouting.ExtractFromSource) {
958+
return indexRouting.indexShard(id, routing, contentType, source());
959+
} else {
960+
return indexRouting.indexShard(id, routing, contentType, null);
961+
}
956962
}
957963

958964
public IndexRequest setRequireAlias(boolean requireAlias) {

server/src/main/java/org/elasticsearch/index/mapper/DocumentParser.java

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -28,12 +28,15 @@
2828
import org.elasticsearch.plugins.internal.XContentMeteringParserDecorator;
2929
import org.elasticsearch.search.lookup.SearchLookup;
3030
import org.elasticsearch.search.lookup.Source;
31+
import org.elasticsearch.xcontent.DeprecationHandler;
32+
import org.elasticsearch.xcontent.NamedXContentRegistry;
3133
import org.elasticsearch.xcontent.XContentBuilder;
3234
import org.elasticsearch.xcontent.XContentLocation;
3335
import org.elasticsearch.xcontent.XContentParseException;
3436
import org.elasticsearch.xcontent.XContentParser;
3537
import org.elasticsearch.xcontent.XContentParserConfiguration;
3638
import org.elasticsearch.xcontent.XContentType;
39+
import org.elasticsearch.xcontent.support.MapXContentParser;
3740

3841
import java.io.IOException;
3942
import java.util.ArrayList;
@@ -128,9 +131,11 @@ private XContentParser getParser(SourceToParse source, @Nullable Map<String, Obj
128131
xContentType
129132
);
130133
} else {
131-
return XContentHelper.mapToXContentParser(
132-
parserConfiguration.withIncludeSourceOnError(source.getIncludeSourceOnError()),
133-
structuredSource
134+
return new MapXContentParser(
135+
NamedXContentRegistry.EMPTY,
136+
DeprecationHandler.IGNORE_DEPRECATIONS,
137+
structuredSource,
138+
xContentType
134139
);
135140
}
136141
}

0 commit comments

Comments
 (0)