Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
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 @@ -802,6 +802,7 @@ public MultiFields build(Mapper.Builder mainFieldBuilder, BuilderContext context
return empty();
} else {
context.path().add(mainFieldBuilder.name());
context.setMultiField(true);
Map mapperBuilders = this.mapperBuilders;
for (final Map.Entry<String, Mapper.Builder> cursor : this.mapperBuilders.entrySet()) {
String key = cursor.getKey();
Expand All @@ -810,6 +811,7 @@ public MultiFields build(Mapper.Builder mainFieldBuilder, BuilderContext context
assert mapper instanceof FieldMapper;
mapperBuilders.put(key, mapper);
}
context.setMultiField(false);
context.path().remove();
final Map<String, FieldMapper> mappers = (Map<String, FieldMapper>) mapperBuilders;
return new MultiFields(mappers);
Expand Down
10 changes: 10 additions & 0 deletions server/src/main/java/org/opensearch/index/mapper/Mapper.java
Original file line number Diff line number Diff line change
Expand Up @@ -96,6 +96,16 @@ public Settings indexSettings() {
return this.indexSettings;
}

private boolean multiField = false;

public boolean isMultiField() {
return multiField;
}

public void setMultiField(boolean multiField) {
this.multiField = multiField;
}

public void assignCapabilities(MappedFieldType fieldType) {
if (capabilityAssigner != null) {
capabilityAssigner.accept(fieldType);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -473,8 +473,9 @@ protected PhraseFieldMapper buildPhraseMapper(FieldType fieldType, TextFieldType
public TextFieldMapper build(BuilderContext context) {
FieldType fieldType = TextParams.buildFieldType(index, store, indexOptions, norms, termVectors);
TextFieldType tft = buildFieldType(fieldType, context);
if (context.indexSettings().getAsBoolean(IndexSettings.INDEX_DERIVED_SOURCE_SETTING.getKey(), false)
|| context.indexSettings().getAsBoolean(IndexSettings.PLUGGABLE_DATAFORMAT_ENABLED_SETTING.getKey(), false)) {
if ((context.indexSettings().getAsBoolean(IndexSettings.INDEX_DERIVED_SOURCE_SETTING.getKey(), false)
|| context.indexSettings().getAsBoolean(IndexSettings.PLUGGABLE_DATAFORMAT_ENABLED_SETTING.getKey(), false))
&& !context.isMultiField()) {
fieldType.setStored(true);
}
return new TextFieldMapper(
Expand Down
Loading