Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -702,8 +702,6 @@ private static void parseNonDynamicArray(
boolean supportStoringArrayOffsets = mapper != null && mapper.supportStoringArrayOffsets();
String fullPath = context.path().pathAsText(arrayFieldName);

// Check if we need to record the array source. This only applies to synthetic source.
boolean canRemoveSingleLeafElement = false;
if (context.canAddIgnoredField() && supportStoringArrayOffsets == false) {
Mapper.SourceKeepMode mode = Mapper.SourceKeepMode.NONE;
boolean objectWithFallbackSyntheticSource = false;
Expand All @@ -721,13 +719,6 @@ private static void parseNonDynamicArray(
}
boolean copyToFieldHasValuesInDocument = context.isWithinCopyTo() == false && context.isCopyToDestinationField(fullPath);

canRemoveSingleLeafElement = mapper instanceof FieldMapper
&& mode == Mapper.SourceKeepMode.ARRAYS
&& context.inArrayScope() == false
&& mapper.leafName().equals(NOOP_FIELD_MAPPER_NAME) == false
&& fieldWithFallbackSyntheticSource == false
&& copyToFieldHasValuesInDocument == false;

if (objectWithFallbackSyntheticSource
|| fieldWithFallbackSyntheticSource
|| fieldWithStoredArraySource
Expand Down Expand Up @@ -776,9 +767,6 @@ private static void parseNonDynamicArray(
&& context.isImmediateParentAnArray()) {
context.getOffSetContext().maybeRecordEmptyArray(mapper.getOffsetFieldName());
}
if (elements <= 1 && canRemoveSingleLeafElement) {
context.removeLastIgnoredField(fullPath);
}
postProcessDynamicArrayMapping(context, lastFieldName);
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -335,12 +335,6 @@ public final void addIgnoredField(IgnoredSourceFieldMapper.NameValue values) {
}
}

final void removeLastIgnoredField(String name) {
if (ignoredFieldValues.isEmpty() == false && ignoredFieldValues.getLast().name().equals(name)) {
ignoredFieldValues.removeLast();
}
}

/**
* Return the collection of values for fields that have been ignored so far.
*/
Expand Down