Skip to content

Commit 6730822

Browse files
committed
Now that SFM doesn't get serialized the parser needs trigger validation based on default instances being returned.
1 parent 62334b3 commit 6730822

File tree

1 file changed

+7
-2
lines changed

1 file changed

+7
-2
lines changed

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

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -301,10 +301,11 @@ private static SourceFieldMapper resolveStaticInstance(final Mode sourceMode) {
301301
if (indexMode == IndexMode.STANDARD && settingSourceMode == Mode.STORED) {
302302
return DEFAULT;
303303
}
304+
SourceFieldMapper sourceFieldMapper = null;
304305
if (onOrAfterDeprecateModeVersion(c.indexVersionCreated())) {
305-
return resolveStaticInstance(settingSourceMode);
306+
sourceFieldMapper = resolveStaticInstance(settingSourceMode);
306307
} else {
307-
return new SourceFieldMapper(
308+
sourceFieldMapper = new SourceFieldMapper(
308309
settingSourceMode,
309310
Explicit.IMPLICIT_TRUE,
310311
Strings.EMPTY_ARRAY,
@@ -313,6 +314,10 @@ private static SourceFieldMapper resolveStaticInstance(final Mode sourceMode) {
313314
c.indexVersionCreated().onOrAfter(IndexVersions.SOURCE_MAPPER_MODE_ATTRIBUTE_NOOP)
314315
);
315316
}
317+
// By default no attributes are specified and so the Builder doesn't get used.
318+
// Need to validate the returned instance based on index mode:
319+
indexMode.validateSourceFieldMapper(sourceFieldMapper);
320+
return sourceFieldMapper;
316321
},
317322
c -> new Builder(
318323
c.getIndexSettings().getMode(),

0 commit comments

Comments
 (0)