@@ -111,6 +111,7 @@ public int get() {
111111 private final Set <String > ignoredFields ;
112112 private final List <IgnoredSourceFieldMapper .NameValue > ignoredFieldValues ;
113113 private final List <IgnoredSourceFieldMapper .NameValue > ignoredFieldsMissingValues ;
114+ private final boolean inArrayScopeEnabled ;
114115 private boolean inArrayScope ;
115116
116117 private final Map <String , List <Mapper >> dynamicMappers ;
@@ -143,6 +144,7 @@ private DocumentParserContext(
143144 Set <String > ignoreFields ,
144145 List <IgnoredSourceFieldMapper .NameValue > ignoredFieldValues ,
145146 List <IgnoredSourceFieldMapper .NameValue > ignoredFieldsWithNoSource ,
147+ boolean inArrayScopeEnabled ,
146148 boolean inArrayScope ,
147149 Map <String , List <Mapper >> dynamicMappers ,
148150 Map <String , ObjectMapper > dynamicObjectMappers ,
@@ -164,6 +166,7 @@ private DocumentParserContext(
164166 this .ignoredFields = ignoreFields ;
165167 this .ignoredFieldValues = ignoredFieldValues ;
166168 this .ignoredFieldsMissingValues = ignoredFieldsWithNoSource ;
169+ this .inArrayScopeEnabled = inArrayScopeEnabled ;
167170 this .inArrayScope = inArrayScope ;
168171 this .dynamicMappers = dynamicMappers ;
169172 this .dynamicObjectMappers = dynamicObjectMappers ;
@@ -188,6 +191,7 @@ private DocumentParserContext(ObjectMapper parent, ObjectMapper.Dynamic dynamic,
188191 in .ignoredFields ,
189192 in .ignoredFieldValues ,
190193 in .ignoredFieldsMissingValues ,
194+ in .inArrayScopeEnabled ,
191195 in .inArrayScope ,
192196 in .dynamicMappers ,
193197 in .dynamicObjectMappers ,
@@ -219,6 +223,7 @@ protected DocumentParserContext(
219223 new HashSet <>(),
220224 new ArrayList <>(),
221225 new ArrayList <>(),
226+ mappingParserContext .getIndexSettings ().isSyntheticSourceSecondDocParsingPassEnabled (),
222227 false ,
223228 new HashMap <>(),
224229 new HashMap <>(),
@@ -371,7 +376,7 @@ public final Collection<IgnoredSourceFieldMapper.NameValue> getIgnoredFieldsMiss
371376 * Applies to synthetic source only.
372377 */
373378 public final DocumentParserContext maybeCloneForArray (Mapper mapper ) throws IOException {
374- if (canAddIgnoredField () && mapper instanceof ObjectMapper && indexSettings (). isSyntheticSourceSecondDocParsingPassEnabled () ) {
379+ if (canAddIgnoredField () && mapper instanceof ObjectMapper && inArrayScopeEnabled ) {
375380 boolean isNested = mapper instanceof NestedObjectMapper ;
376381 if ((inArrayScope == false && isNested == false ) || (inArrayScope && isNested )) {
377382 DocumentParserContext subcontext = switchParser (parser ());
0 commit comments