Last active
March 14, 2024 16:00
-
-
Save martijnvg/2f2067274a8a1d62b4f6353a2979ef93 to your computer and use it in GitHub Desktop.
text-field-synthetic-source
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Subject: [PATCH] Time series agg improvement | |
Only generate tsid once per tsid hash and segment. | |
--- | |
Index: server/src/test/java/org/elasticsearch/index/mapper/ObjectMapperTests.java | |
IDEA additional info: | |
Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP | |
<+>UTF-8 | |
=================================================================== | |
diff --git a/server/src/test/java/org/elasticsearch/index/mapper/ObjectMapperTests.java b/server/src/test/java/org/elasticsearch/index/mapper/ObjectMapperTests.java | |
--- a/server/src/test/java/org/elasticsearch/index/mapper/ObjectMapperTests.java (revision ac4e2f43b7ff957b78b7faf598dd378f7073ed2b) | |
+++ b/server/src/test/java/org/elasticsearch/index/mapper/ObjectMapperTests.java (date 1710413665084) | |
@@ -530,11 +530,11 @@ | |
public void testNestedObjectWithMultiFieldsgetTotalFieldsCount() { | |
ObjectMapper.Builder mapperBuilder = new ObjectMapper.Builder("parent_size_1", Explicit.IMPLICIT_TRUE).add( | |
new ObjectMapper.Builder("child_size_2", Explicit.IMPLICIT_TRUE).add( | |
- new TextFieldMapper.Builder("grand_child_size_3", createDefaultIndexAnalyzers()).addMultiField( | |
+ new TextFieldMapper.Builder("grand_child_size_3", createDefaultIndexAnalyzers(), false).addMultiField( | |
new KeywordFieldMapper.Builder("multi_field_size_4", IndexVersion.current()) | |
) | |
.addMultiField( | |
- new TextFieldMapper.Builder("grand_child_size_5", createDefaultIndexAnalyzers()).addMultiField( | |
+ new TextFieldMapper.Builder("grand_child_size_5", createDefaultIndexAnalyzers(), false).addMultiField( | |
new KeywordFieldMapper.Builder("multi_field_of_multi_field_size_6", IndexVersion.current()) | |
) | |
) | |
Index: server/src/main/java/org/elasticsearch/index/mapper/TextFieldMapper.java | |
IDEA additional info: | |
Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP | |
<+>UTF-8 | |
=================================================================== | |
diff --git a/server/src/main/java/org/elasticsearch/index/mapper/TextFieldMapper.java b/server/src/main/java/org/elasticsearch/index/mapper/TextFieldMapper.java | |
--- a/server/src/main/java/org/elasticsearch/index/mapper/TextFieldMapper.java (revision ac4e2f43b7ff957b78b7faf598dd378f7073ed2b) | |
+++ b/server/src/main/java/org/elasticsearch/index/mapper/TextFieldMapper.java (date 1710431985982) | |
@@ -238,7 +238,7 @@ | |
private final IndexVersion indexCreatedVersion; | |
private final Parameter<Boolean> index = Parameter.indexParam(m -> ((TextFieldMapper) m).index, true); | |
- private final Parameter<Boolean> store = Parameter.storeParam(m -> ((TextFieldMapper) m).store, false); | |
+ private final Parameter<Boolean> store; | |
final Parameter<SimilarityProvider> similarity = TextParams.similarity(m -> ((TextFieldMapper) m).similarity); | |
@@ -283,11 +283,11 @@ | |
final TextParams.Analyzers analyzers; | |
- public Builder(String name, IndexAnalyzers indexAnalyzers) { | |
- this(name, IndexVersion.current(), indexAnalyzers); | |
+ public Builder(String name, IndexAnalyzers indexAnalyzers, boolean syntheticSource) { | |
+ this(name, IndexVersion.current(), indexAnalyzers, syntheticSource); | |
} | |
- public Builder(String name, IndexVersion indexCreatedVersion, IndexAnalyzers indexAnalyzers) { | |
+ public Builder(String name, IndexVersion indexCreatedVersion, IndexAnalyzers indexAnalyzers, boolean syntheticSource) { | |
super(name); | |
this.indexCreatedVersion = indexCreatedVersion; | |
this.analyzers = new TextParams.Analyzers( | |
@@ -296,6 +296,15 @@ | |
m -> (((TextFieldMapper) m).positionIncrementGap), | |
indexCreatedVersion | |
); | |
+ | |
+ this.store = Parameter.storeParam( | |
+ m -> ((TextFieldMapper) m).store, | |
+ () -> syntheticSource && multiFieldsBuilder.hasSyntheticSourceCompatibleKeywordField() == false | |
+ ).addValidator(value -> { | |
+ if (syntheticSource && multiFieldsBuilder.hasSyntheticSourceCompatibleKeywordField() == false && value == false) { | |
+ throw new IllegalArgumentException("If synthetic source is enabled, then store cannot be set to false"); | |
+ } | |
+ }); | |
} | |
public Builder index(boolean index) { | |
@@ -483,7 +492,7 @@ | |
private static final IndexVersion MINIMUM_COMPATIBILITY_VERSION = IndexVersion.fromId(5000099); | |
public static final TypeParser PARSER = new TypeParser( | |
- (n, c) -> new Builder(n, c.indexVersionCreated(), c.getIndexAnalyzers()), | |
+ (n, c) -> new Builder(n, c.indexVersionCreated(), c.getIndexAnalyzers(), c.isSyntheticSource()), | |
MINIMUM_COMPATIBILITY_VERSION | |
); | |
@@ -1258,7 +1267,7 @@ | |
@Override | |
public FieldMapper.Builder getMergeBuilder() { | |
- return new Builder(simpleName(), indexCreatedVersion, indexAnalyzers).init(this); | |
+ return new Builder(simpleName(), indexCreatedVersion, indexAnalyzers, false).init(this); | |
} | |
@Override | |
Index: server/src/test/java/org/elasticsearch/index/query/SearchExecutionContextTests.java | |
IDEA additional info: | |
Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP | |
<+>UTF-8 | |
=================================================================== | |
diff --git a/server/src/test/java/org/elasticsearch/index/query/SearchExecutionContextTests.java b/server/src/test/java/org/elasticsearch/index/query/SearchExecutionContextTests.java | |
--- a/server/src/test/java/org/elasticsearch/index/query/SearchExecutionContextTests.java (revision ac4e2f43b7ff957b78b7faf598dd378f7073ed2b) | |
+++ b/server/src/test/java/org/elasticsearch/index/query/SearchExecutionContextTests.java (date 1710412873198) | |
@@ -467,8 +467,8 @@ | |
ScriptCompiler.NONE, | |
indexAnalyzers, | |
indexSettings, | |
- indexSettings.getMode().buildIdFieldMapper(() -> true) | |
- ) | |
+ indexSettings.getMode().buildIdFieldMapper(() -> true), | |
+ false) | |
); | |
when(mapperService.isMultiField(anyString())).then( | |
(Answer<Boolean>) invocation -> mappingLookup.isMultiField(invocation.getArgument(0)) | |
Index: server/src/test/java/org/elasticsearch/index/mapper/DocumentParserContextTests.java | |
IDEA additional info: | |
Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP | |
<+>UTF-8 | |
=================================================================== | |
diff --git a/server/src/test/java/org/elasticsearch/index/mapper/DocumentParserContextTests.java b/server/src/test/java/org/elasticsearch/index/mapper/DocumentParserContextTests.java | |
--- a/server/src/test/java/org/elasticsearch/index/mapper/DocumentParserContextTests.java (revision ac4e2f43b7ff957b78b7faf598dd378f7073ed2b) | |
+++ b/server/src/test/java/org/elasticsearch/index/mapper/DocumentParserContextTests.java (date 1710413665091) | |
@@ -20,9 +20,9 @@ | |
private final MapperBuilderContext root = MapperBuilderContext.root(false, false); | |
public void testDynamicMapperSizeMultipleMappers() { | |
- context.addDynamicMapper(new TextFieldMapper.Builder("foo", createDefaultIndexAnalyzers()).build(root)); | |
+ context.addDynamicMapper(new TextFieldMapper.Builder("foo", createDefaultIndexAnalyzers(), false).build(root)); | |
assertEquals(1, context.getNewFieldsSize()); | |
- context.addDynamicMapper(new TextFieldMapper.Builder("bar", createDefaultIndexAnalyzers()).build(root)); | |
+ context.addDynamicMapper(new TextFieldMapper.Builder("bar", createDefaultIndexAnalyzers(), false).build(root)); | |
assertEquals(2, context.getNewFieldsSize()); | |
context.addDynamicRuntimeField(new TestRuntimeField("runtime1", "keyword")); | |
assertEquals(3, context.getNewFieldsSize()); | |
@@ -37,9 +37,9 @@ | |
} | |
public void testDynamicMapperSizeSameFieldMultipleMappers() { | |
- context.addDynamicMapper(new TextFieldMapper.Builder("foo", createDefaultIndexAnalyzers()).build(root)); | |
+ context.addDynamicMapper(new TextFieldMapper.Builder("foo", createDefaultIndexAnalyzers(), false).build(root)); | |
assertEquals(1, context.getNewFieldsSize()); | |
- context.addDynamicMapper(new TextFieldMapper.Builder("foo", createDefaultIndexAnalyzers()).build(root)); | |
+ context.addDynamicMapper(new TextFieldMapper.Builder("foo", createDefaultIndexAnalyzers(), false).build(root)); | |
assertEquals(1, context.getNewFieldsSize()); | |
} | |
Index: server/src/main/java/org/elasticsearch/index/mapper/KeywordFieldMapper.java | |
IDEA additional info: | |
Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP | |
<+>UTF-8 | |
=================================================================== | |
diff --git a/server/src/main/java/org/elasticsearch/index/mapper/KeywordFieldMapper.java b/server/src/main/java/org/elasticsearch/index/mapper/KeywordFieldMapper.java | |
--- a/server/src/main/java/org/elasticsearch/index/mapper/KeywordFieldMapper.java (revision ac4e2f43b7ff957b78b7faf598dd378f7073ed2b) | |
+++ b/server/src/main/java/org/elasticsearch/index/mapper/KeywordFieldMapper.java (date 1710431985993) | |
@@ -222,11 +222,19 @@ | |
return this; | |
} | |
+ public boolean hasIgnoreAbove() { | |
+ return ignoreAbove.get() != Defaults.IGNORE_ABOVE; | |
+ } | |
+ | |
Builder normalizer(String normalizerName) { | |
this.normalizer.setValue(normalizerName); | |
return this; | |
} | |
+ public boolean hasNormalizer() { | |
+ return normalizer.get() != null; | |
+ } | |
+ | |
Builder nullValue(String nullValue) { | |
this.nullValue.setValue(nullValue); | |
return this; | |
@@ -237,6 +245,10 @@ | |
return this; | |
} | |
+ public boolean hasDocValues() { | |
+ return hasDocValues.get(); | |
+ } | |
+ | |
public Builder dimension(boolean dimension) { | |
this.dimension.setValue(dimension); | |
return this; | |
@@ -247,6 +259,10 @@ | |
return this; | |
} | |
+ public boolean hasStored() { | |
+ return stored.getValue(); | |
+ } | |
+ | |
private FieldValues<String> scriptValues() { | |
if (script.get() == null) { | |
return null; | |
@@ -845,6 +861,10 @@ | |
public boolean hasNormalizer() { | |
return normalizer != Lucene.KEYWORD_ANALYZER; | |
} | |
+ | |
+ public boolean hasIgnoreAbove() { | |
+ return ignoreAbove != Defaults.IGNORE_ABOVE; | |
+ } | |
} | |
private final boolean indexed; | |
Index: server/src/test/java/org/elasticsearch/index/fielddata/AbstractFieldDataTestCase.java | |
IDEA additional info: | |
Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP | |
<+>UTF-8 | |
=================================================================== | |
diff --git a/server/src/test/java/org/elasticsearch/index/fielddata/AbstractFieldDataTestCase.java b/server/src/test/java/org/elasticsearch/index/fielddata/AbstractFieldDataTestCase.java | |
--- a/server/src/test/java/org/elasticsearch/index/fielddata/AbstractFieldDataTestCase.java (revision ac4e2f43b7ff957b78b7faf598dd378f7073ed2b) | |
+++ b/server/src/test/java/org/elasticsearch/index/fielddata/AbstractFieldDataTestCase.java (date 1710413665095) | |
@@ -90,7 +90,7 @@ | |
if (docValues) { | |
fieldType = new KeywordFieldMapper.Builder(fieldName, IndexVersion.current()).build(context).fieldType(); | |
} else { | |
- fieldType = new TextFieldMapper.Builder(fieldName, createDefaultIndexAnalyzers()).fielddata(true) | |
+ fieldType = new TextFieldMapper.Builder(fieldName, createDefaultIndexAnalyzers(), false).fielddata(true) | |
.build(context) | |
.fieldType(); | |
} | |
Index: server/src/main/java/org/elasticsearch/index/mapper/DynamicFieldsBuilder.java | |
IDEA additional info: | |
Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP | |
<+>UTF-8 | |
=================================================================== | |
diff --git a/server/src/main/java/org/elasticsearch/index/mapper/DynamicFieldsBuilder.java b/server/src/main/java/org/elasticsearch/index/mapper/DynamicFieldsBuilder.java | |
--- a/server/src/main/java/org/elasticsearch/index/mapper/DynamicFieldsBuilder.java (revision ac4e2f43b7ff957b78b7faf598dd378f7073ed2b) | |
+++ b/server/src/main/java/org/elasticsearch/index/mapper/DynamicFieldsBuilder.java (date 1710413665110) | |
@@ -333,7 +333,7 @@ | |
); | |
} else { | |
return createDynamicField( | |
- new TextFieldMapper.Builder(name, context.indexAnalyzers()).addMultiField( | |
+ new TextFieldMapper.Builder(name, context.indexAnalyzers(), context.mappingLookup().isSourceSynthetic()).addMultiField( | |
new KeywordFieldMapper.Builder("keyword", context.indexSettings().getIndexVersionCreated()).ignoreAbove(256) | |
), | |
context | |
Index: server/src/test/java/org/elasticsearch/index/mapper/ObjectMapperMergeTests.java | |
IDEA additional info: | |
Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP | |
<+>UTF-8 | |
=================================================================== | |
diff --git a/server/src/test/java/org/elasticsearch/index/mapper/ObjectMapperMergeTests.java b/server/src/test/java/org/elasticsearch/index/mapper/ObjectMapperMergeTests.java | |
--- a/server/src/test/java/org/elasticsearch/index/mapper/ObjectMapperMergeTests.java (revision ac4e2f43b7ff957b78b7faf598dd378f7073ed2b) | |
+++ b/server/src/test/java/org/elasticsearch/index/mapper/ObjectMapperMergeTests.java (date 1710413665096) | |
@@ -27,10 +27,10 @@ | |
rootBuilder.add(new ObjectMapper.Builder("disabled", Explicit.IMPLICIT_TRUE).enabled(disabledFieldEnabled)); | |
ObjectMapper.Builder fooBuilder = new ObjectMapper.Builder("foo", Explicit.IMPLICIT_TRUE).enabled(fooFieldEnabled); | |
if (includeBarField) { | |
- fooBuilder.add(new TextFieldMapper.Builder("bar", createDefaultIndexAnalyzers())); | |
+ fooBuilder.add(new TextFieldMapper.Builder("bar", createDefaultIndexAnalyzers(), false)); | |
} | |
if (includeBazField) { | |
- fooBuilder.add(new TextFieldMapper.Builder("baz", createDefaultIndexAnalyzers())); | |
+ fooBuilder.add(new TextFieldMapper.Builder("baz", createDefaultIndexAnalyzers(), false)); | |
} | |
rootBuilder.add(fooBuilder); | |
return rootBuilder.build(MapperBuilderContext.root(false, false)); | |
@@ -366,7 +366,7 @@ | |
} | |
private TextFieldMapper.Builder createTextKeywordMultiField(String name, String multiFieldName) { | |
- TextFieldMapper.Builder builder = new TextFieldMapper.Builder(name, createDefaultIndexAnalyzers()); | |
+ TextFieldMapper.Builder builder = new TextFieldMapper.Builder(name, createDefaultIndexAnalyzers(), false); | |
builder.multiFieldsBuilder.add(new KeywordFieldMapper.Builder(multiFieldName, IndexVersion.current())); | |
return builder; | |
} | |
Index: server/src/test/java/org/elasticsearch/index/mapper/TypeParsersTests.java | |
IDEA additional info: | |
Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP | |
<+>UTF-8 | |
=================================================================== | |
diff --git a/server/src/test/java/org/elasticsearch/index/mapper/TypeParsersTests.java b/server/src/test/java/org/elasticsearch/index/mapper/TypeParsersTests.java | |
--- a/server/src/test/java/org/elasticsearch/index/mapper/TypeParsersTests.java (revision ac4e2f43b7ff957b78b7faf598dd378f7073ed2b) | |
+++ b/server/src/test/java/org/elasticsearch/index/mapper/TypeParsersTests.java (date 1710412873185) | |
@@ -97,8 +97,8 @@ | |
ScriptCompiler.NONE, | |
mapperService.getIndexAnalyzers(), | |
mapperService.getIndexSettings(), | |
- ProvidedIdFieldMapper.NO_FIELD_DATA | |
- ); | |
+ ProvidedIdFieldMapper.NO_FIELD_DATA, | |
+ false); | |
TextFieldMapper.PARSER.parse("some-field", fieldNode, olderContext); | |
assertWarnings( | |
@@ -128,8 +128,8 @@ | |
ScriptCompiler.NONE, | |
mapperService.getIndexAnalyzers(), | |
mapperService.getIndexSettings(), | |
- ProvidedIdFieldMapper.NO_FIELD_DATA | |
- ); | |
+ ProvidedIdFieldMapper.NO_FIELD_DATA, | |
+ false); | |
IllegalArgumentException e = expectThrows(IllegalArgumentException.class, () -> { | |
TextFieldMapper.PARSER.parse("textField", fieldNodeCopy, context); | |
Index: server/src/main/java/org/elasticsearch/index/query/QueryRewriteContext.java | |
IDEA additional info: | |
Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP | |
<+>UTF-8 | |
=================================================================== | |
diff --git a/server/src/main/java/org/elasticsearch/index/query/QueryRewriteContext.java b/server/src/main/java/org/elasticsearch/index/query/QueryRewriteContext.java | |
--- a/server/src/main/java/org/elasticsearch/index/query/QueryRewriteContext.java (revision ac4e2f43b7ff957b78b7faf598dd378f7073ed2b) | |
+++ b/server/src/main/java/org/elasticsearch/index/query/QueryRewriteContext.java (date 1710413665089) | |
@@ -196,7 +196,7 @@ | |
if (fieldMapping != null || allowUnmappedFields) { | |
return fieldMapping; | |
} else if (mapUnmappedFieldAsString) { | |
- TextFieldMapper.Builder builder = new TextFieldMapper.Builder(name, getIndexAnalyzers()); | |
+ TextFieldMapper.Builder builder = new TextFieldMapper.Builder(name, getIndexAnalyzers(), mappingLookup.isSourceSynthetic()); | |
return builder.build(MapperBuilderContext.root(false, false)).fieldType(); | |
} else { | |
throw new QueryShardException(this, "No field mapping can be found for the field with name [{}]", name); | |
Index: server/src/main/java/org/elasticsearch/index/mapper/FieldMapper.java | |
IDEA additional info: | |
Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP | |
<+>UTF-8 | |
=================================================================== | |
diff --git a/server/src/main/java/org/elasticsearch/index/mapper/FieldMapper.java b/server/src/main/java/org/elasticsearch/index/mapper/FieldMapper.java | |
--- a/server/src/main/java/org/elasticsearch/index/mapper/FieldMapper.java (revision ac4e2f43b7ff957b78b7faf598dd378f7073ed2b) | |
+++ b/server/src/main/java/org/elasticsearch/index/mapper/FieldMapper.java (date 1710431985996) | |
@@ -449,14 +449,27 @@ | |
public static class Builder { | |
private final Map<String, Function<MapperBuilderContext, FieldMapper>> mapperBuilders = new HashMap<>(); | |
+ private boolean hasSyntheticSourceCompatibleKeywordField; | |
public Builder add(FieldMapper.Builder builder) { | |
mapperBuilders.put(builder.name(), builder::build); | |
+ if (builder instanceof KeywordFieldMapper.Builder kwd) { | |
+ if (kwd.hasNormalizer() == false && kwd.hasIgnoreAbove() == false && (kwd.hasDocValues() || kwd.hasStored())) { | |
+ hasSyntheticSourceCompatibleKeywordField = true; | |
+ } | |
+ } | |
return this; | |
} | |
private void add(FieldMapper mapper) { | |
mapperBuilders.put(mapper.simpleName(), context -> mapper); | |
+ if (mapper instanceof KeywordFieldMapper kwd) { | |
+ if (kwd.hasNormalizer() == false | |
+ && kwd.fieldType().hasIgnoreAbove() | |
+ && (kwd.fieldType().hasDocValues() || kwd.fieldType().isStored())) { | |
+ hasSyntheticSourceCompatibleKeywordField = true; | |
+ } | |
+ } | |
} | |
private void update(FieldMapper toMerge, MapperMergeContext context) { | |
@@ -474,6 +487,10 @@ | |
return mapperBuilders.isEmpty() == false; | |
} | |
+ public boolean hasSyntheticSourceCompatibleKeywordField() { | |
+ return hasSyntheticSourceCompatibleKeywordField; | |
+ } | |
+ | |
public MultiFields build(Mapper.Builder mainFieldBuilder, MapperBuilderContext context) { | |
if (mapperBuilders.isEmpty()) { | |
return empty(); | |
@@ -1133,6 +1150,10 @@ | |
public static Parameter<Boolean> storeParam(Function<FieldMapper, Boolean> initializer, boolean defaultValue) { | |
return Parameter.boolParam("store", false, initializer, defaultValue); | |
} | |
+ | |
+ public static Parameter<Boolean> storeParam(Function<FieldMapper, Boolean> initializer, Supplier<Boolean> defaultValue) { | |
+ return Parameter.boolParam("store", false, initializer, defaultValue); | |
+ } | |
public static Parameter<Boolean> docValuesParam(Function<FieldMapper, Boolean> initializer, boolean defaultValue) { | |
return Parameter.boolParam("doc_values", false, initializer, defaultValue); | |
Index: server/src/main/java/org/elasticsearch/index/mapper/MappingParserContext.java | |
IDEA additional info: | |
Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP | |
<+>UTF-8 | |
=================================================================== | |
diff --git a/server/src/main/java/org/elasticsearch/index/mapper/MappingParserContext.java b/server/src/main/java/org/elasticsearch/index/mapper/MappingParserContext.java | |
--- a/server/src/main/java/org/elasticsearch/index/mapper/MappingParserContext.java (revision ac4e2f43b7ff957b78b7faf598dd378f7073ed2b) | |
+++ b/server/src/main/java/org/elasticsearch/index/mapper/MappingParserContext.java (date 1710413294708) | |
@@ -39,6 +39,7 @@ | |
private final IdFieldMapper idFieldMapper; | |
private final long mappingObjectDepthLimit; | |
private long mappingObjectDepth = 0; | |
+ private final boolean syntheticSource; | |
public MappingParserContext( | |
Function<String, SimilarityProvider> similarityLookupService, | |
@@ -50,8 +51,8 @@ | |
ScriptCompiler scriptCompiler, | |
IndexAnalyzers indexAnalyzers, | |
IndexSettings indexSettings, | |
- IdFieldMapper idFieldMapper | |
- ) { | |
+ IdFieldMapper idFieldMapper, | |
+ boolean syntheticSource) { | |
this.similarityLookupService = similarityLookupService; | |
this.typeParsers = typeParsers; | |
this.runtimeFieldParsers = runtimeFieldParsers; | |
@@ -63,6 +64,7 @@ | |
this.indexSettings = indexSettings; | |
this.idFieldMapper = idFieldMapper; | |
this.mappingObjectDepthLimit = indexSettings.getMappingDepthLimit(); | |
+ this.syntheticSource = syntheticSource; | |
} | |
public IndexAnalyzers getIndexAnalyzers() { | |
@@ -132,6 +134,10 @@ | |
return scriptCompiler; | |
} | |
+ public boolean isSyntheticSource() { | |
+ return syntheticSource; | |
+ } | |
+ | |
void incrementMappingObjectDepth() throws MapperParsingException { | |
mappingObjectDepth++; | |
if (mappingObjectDepth > mappingObjectDepthLimit) { | |
@@ -159,8 +165,8 @@ | |
in.scriptCompiler, | |
in.indexAnalyzers, | |
in.indexSettings, | |
- in.idFieldMapper | |
- ); | |
+ in.idFieldMapper, | |
+ in.syntheticSource); | |
} | |
@Override | |
@@ -188,8 +194,8 @@ | |
in.scriptCompiler, | |
in.indexAnalyzers, | |
in.indexSettings, | |
- in.idFieldMapper | |
- ); | |
+ in.idFieldMapper, | |
+ in.syntheticSource); | |
this.dateFormatter = dateFormatter; | |
} | |
Index: test/framework/src/main/java/org/elasticsearch/search/aggregations/AggregatorTestCase.java | |
IDEA additional info: | |
Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP | |
<+>UTF-8 | |
=================================================================== | |
diff --git a/test/framework/src/main/java/org/elasticsearch/search/aggregations/AggregatorTestCase.java b/test/framework/src/main/java/org/elasticsearch/search/aggregations/AggregatorTestCase.java | |
--- a/test/framework/src/main/java/org/elasticsearch/search/aggregations/AggregatorTestCase.java (revision ac4e2f43b7ff957b78b7faf598dd378f7073ed2b) | |
+++ b/test/framework/src/main/java/org/elasticsearch/search/aggregations/AggregatorTestCase.java (date 1710412873202) | |
@@ -1280,8 +1280,8 @@ | |
ScriptCompiler.NONE, | |
null, | |
indexSettings, | |
- null | |
- ); | |
+ null, | |
+ false); | |
} | |
@Override | |
Index: server/src/test/java/org/elasticsearch/index/mapper/ParametrizedMapperTests.java | |
IDEA additional info: | |
Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP | |
<+>UTF-8 | |
=================================================================== | |
diff --git a/server/src/test/java/org/elasticsearch/index/mapper/ParametrizedMapperTests.java b/server/src/test/java/org/elasticsearch/index/mapper/ParametrizedMapperTests.java | |
--- a/server/src/test/java/org/elasticsearch/index/mapper/ParametrizedMapperTests.java (revision ac4e2f43b7ff957b78b7faf598dd378f7073ed2b) | |
+++ b/server/src/test/java/org/elasticsearch/index/mapper/ParametrizedMapperTests.java (date 1710412873182) | |
@@ -277,8 +277,8 @@ | |
ScriptCompiler.NONE, | |
mapperService.getIndexAnalyzers(), | |
mapperService.getIndexSettings(), | |
- mapperService.getIndexSettings().getMode().idFieldMapperWithoutFieldData() | |
- ); | |
+ mapperService.getIndexSettings().getMode().idFieldMapperWithoutFieldData(), | |
+ false); | |
if (fromDynamicTemplate) { | |
pc = pc.createDynamicTemplateContext(null); | |
} | |
Index: server/src/main/java/org/elasticsearch/index/mapper/MapperService.java | |
IDEA additional info: | |
Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP | |
<+>UTF-8 | |
=================================================================== | |
diff --git a/server/src/main/java/org/elasticsearch/index/mapper/MapperService.java b/server/src/main/java/org/elasticsearch/index/mapper/MapperService.java | |
--- a/server/src/main/java/org/elasticsearch/index/mapper/MapperService.java (revision ac4e2f43b7ff957b78b7faf598dd378f7073ed2b) | |
+++ b/server/src/main/java/org/elasticsearch/index/mapper/MapperService.java (date 1710412873204) | |
@@ -206,7 +206,8 @@ | |
scriptCompiler, | |
indexAnalyzers, | |
indexSettings, | |
- idFieldMapper | |
+ idFieldMapper, | |
+ mappingLookup().isSourceSynthetic() | |
); | |
this.documentParser = new DocumentParser(parserConfiguration, this.mappingParserContextSupplier.get()); | |
Map<String, MetadataFieldMapper.TypeParser> metadataMapperParsers = mapperRegistry.getMetadataMapperParsers( | |
Index: server/src/test/java/org/elasticsearch/search/fetch/subphase/highlight/HighlightBuilderTests.java | |
IDEA additional info: | |
Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP | |
<+>UTF-8 | |
=================================================================== | |
diff --git a/server/src/test/java/org/elasticsearch/search/fetch/subphase/highlight/HighlightBuilderTests.java b/server/src/test/java/org/elasticsearch/search/fetch/subphase/highlight/HighlightBuilderTests.java | |
--- a/server/src/test/java/org/elasticsearch/search/fetch/subphase/highlight/HighlightBuilderTests.java (revision ac4e2f43b7ff957b78b7faf598dd378f7073ed2b) | |
+++ b/server/src/test/java/org/elasticsearch/search/fetch/subphase/highlight/HighlightBuilderTests.java (date 1710413665102) | |
@@ -317,7 +317,7 @@ | |
) { | |
@Override | |
public MappedFieldType getFieldType(String name) { | |
- TextFieldMapper.Builder builder = new TextFieldMapper.Builder(name, createDefaultIndexAnalyzers()); | |
+ TextFieldMapper.Builder builder = new TextFieldMapper.Builder(name, createDefaultIndexAnalyzers(), false); | |
return builder.build(MapperBuilderContext.root(false, false)).fieldType(); | |
} | |
}; | |
Index: server/src/test/java/org/elasticsearch/index/fielddata/IndexFieldDataServiceTests.java | |
IDEA additional info: | |
Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP | |
<+>UTF-8 | |
=================================================================== | |
diff --git a/server/src/test/java/org/elasticsearch/index/fielddata/IndexFieldDataServiceTests.java b/server/src/test/java/org/elasticsearch/index/fielddata/IndexFieldDataServiceTests.java | |
--- a/server/src/test/java/org/elasticsearch/index/fielddata/IndexFieldDataServiceTests.java (revision ac4e2f43b7ff957b78b7faf598dd378f7073ed2b) | |
+++ b/server/src/test/java/org/elasticsearch/index/fielddata/IndexFieldDataServiceTests.java (date 1710413665099) | |
@@ -156,10 +156,10 @@ | |
); | |
final MapperBuilderContext context = MapperBuilderContext.root(false, false); | |
- final MappedFieldType mapper1 = new TextFieldMapper.Builder("field_1", createDefaultIndexAnalyzers()).fielddata(true) | |
+ final MappedFieldType mapper1 = new TextFieldMapper.Builder("field_1", createDefaultIndexAnalyzers(), false).fielddata(true) | |
.build(context) | |
.fieldType(); | |
- final MappedFieldType mapper2 = new TextFieldMapper.Builder("field_2", createDefaultIndexAnalyzers()).fielddata(true) | |
+ final MappedFieldType mapper2 = new TextFieldMapper.Builder("field_2", createDefaultIndexAnalyzers(), false).fielddata(true) | |
.build(context) | |
.fieldType(); | |
final IndexWriter writer = new IndexWriter(new ByteBuffersDirectory(), new IndexWriterConfig(new KeywordAnalyzer())); | |
@@ -223,7 +223,7 @@ | |
); | |
final MapperBuilderContext context = MapperBuilderContext.root(false, false); | |
- final MappedFieldType mapper1 = new TextFieldMapper.Builder("s", createDefaultIndexAnalyzers()).fielddata(true) | |
+ final MappedFieldType mapper1 = new TextFieldMapper.Builder("s", createDefaultIndexAnalyzers(), false).fielddata(true) | |
.build(context) | |
.fieldType(); | |
final IndexWriter writer = new IndexWriter(new ByteBuffersDirectory(), new IndexWriterConfig(new KeywordAnalyzer())); | |
Index: test/framework/src/main/java/org/elasticsearch/index/mapper/TestDocumentParserContext.java | |
IDEA additional info: | |
Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP | |
<+>UTF-8 | |
=================================================================== | |
diff --git a/test/framework/src/main/java/org/elasticsearch/index/mapper/TestDocumentParserContext.java b/test/framework/src/main/java/org/elasticsearch/index/mapper/TestDocumentParserContext.java | |
--- a/test/framework/src/main/java/org/elasticsearch/index/mapper/TestDocumentParserContext.java (revision ac4e2f43b7ff957b78b7faf598dd378f7073ed2b) | |
+++ b/test/framework/src/main/java/org/elasticsearch/index/mapper/TestDocumentParserContext.java (date 1710412873192) | |
@@ -63,8 +63,8 @@ | |
null, | |
(type, name) -> Lucene.STANDARD_ANALYZER, | |
MapperTestCase.createIndexSettings(IndexVersion.current(), settings), | |
- null | |
- ), | |
+ null, | |
+ false), | |
source, | |
mappingLookup.getMapping().getRoot(), | |
ObjectMapper.Dynamic.getRootDynamic(mappingLookup) | |
Index: server/src/test/java/org/elasticsearch/index/mapper/MappingParserTests.java | |
IDEA additional info: | |
Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP | |
<+>UTF-8 | |
=================================================================== | |
diff --git a/server/src/test/java/org/elasticsearch/index/mapper/MappingParserTests.java b/server/src/test/java/org/elasticsearch/index/mapper/MappingParserTests.java | |
--- a/server/src/test/java/org/elasticsearch/index/mapper/MappingParserTests.java (revision ac4e2f43b7ff957b78b7faf598dd378f7073ed2b) | |
+++ b/server/src/test/java/org/elasticsearch/index/mapper/MappingParserTests.java (date 1710412873195) | |
@@ -55,8 +55,8 @@ | |
scriptService, | |
indexAnalyzers, | |
indexSettings, | |
- indexSettings.getMode().idFieldMapperWithoutFieldData() | |
- ); | |
+ indexSettings.getMode().idFieldMapperWithoutFieldData(), | |
+ false); | |
Map<String, MetadataFieldMapper.TypeParser> metadataMapperParsers = mapperRegistry.getMetadataMapperParsers( | |
indexSettings.getIndexVersionCreated() | |
Index: server/src/test/java/org/elasticsearch/search/rescore/QueryRescorerBuilderTests.java | |
IDEA additional info: | |
Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP | |
<+>UTF-8 | |
=================================================================== | |
diff --git a/server/src/test/java/org/elasticsearch/search/rescore/QueryRescorerBuilderTests.java b/server/src/test/java/org/elasticsearch/search/rescore/QueryRescorerBuilderTests.java | |
--- a/server/src/test/java/org/elasticsearch/search/rescore/QueryRescorerBuilderTests.java (revision ac4e2f43b7ff957b78b7faf598dd378f7073ed2b) | |
+++ b/server/src/test/java/org/elasticsearch/search/rescore/QueryRescorerBuilderTests.java (date 1710413665108) | |
@@ -160,7 +160,7 @@ | |
) { | |
@Override | |
public MappedFieldType getFieldType(String name) { | |
- TextFieldMapper.Builder builder = new TextFieldMapper.Builder(name, createDefaultIndexAnalyzers()); | |
+ TextFieldMapper.Builder builder = new TextFieldMapper.Builder(name, createDefaultIndexAnalyzers(), false); | |
return builder.build(MapperBuilderContext.root(false, false)).fieldType(); | |
} | |
}; | |
@@ -222,7 +222,7 @@ | |
) { | |
@Override | |
public MappedFieldType getFieldType(String name) { | |
- TextFieldMapper.Builder builder = new TextFieldMapper.Builder(name, createDefaultIndexAnalyzers()); | |
+ TextFieldMapper.Builder builder = new TextFieldMapper.Builder(name, createDefaultIndexAnalyzers(), false); | |
return builder.build(MapperBuilderContext.root(false, false)).fieldType(); | |
} | |
}; | |
Index: server/src/test/java/org/elasticsearch/index/fielddata/FilterFieldDataTests.java | |
IDEA additional info: | |
Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP | |
<+>UTF-8 | |
=================================================================== | |
diff --git a/server/src/test/java/org/elasticsearch/index/fielddata/FilterFieldDataTests.java b/server/src/test/java/org/elasticsearch/index/fielddata/FilterFieldDataTests.java | |
--- a/server/src/test/java/org/elasticsearch/index/fielddata/FilterFieldDataTests.java (revision ac4e2f43b7ff957b78b7faf598dd378f7073ed2b) | |
+++ b/server/src/test/java/org/elasticsearch/index/fielddata/FilterFieldDataTests.java (date 1710413665093) | |
@@ -52,7 +52,7 @@ | |
{ | |
indexService.clearCaches(false, true); | |
- MappedFieldType ft = new TextFieldMapper.Builder("high_freq", createDefaultIndexAnalyzers()).fielddata(true) | |
+ MappedFieldType ft = new TextFieldMapper.Builder("high_freq", createDefaultIndexAnalyzers(), false).fielddata(true) | |
.fielddataFrequencyFilter(0, random.nextBoolean() ? 100 : 0.5d, 0) | |
.build(builderContext) | |
.fieldType(); | |
@@ -67,7 +67,7 @@ | |
} | |
{ | |
indexService.clearCaches(false, true); | |
- MappedFieldType ft = new TextFieldMapper.Builder("high_freq", createDefaultIndexAnalyzers()).fielddata(true) | |
+ MappedFieldType ft = new TextFieldMapper.Builder("high_freq", createDefaultIndexAnalyzers(), false).fielddata(true) | |
.fielddataFrequencyFilter(random.nextBoolean() ? 101 : 101d / 200.0d, 201, 100) | |
.build(builderContext) | |
.fieldType(); | |
@@ -82,7 +82,7 @@ | |
{ | |
indexService.clearCaches(false, true);// test # docs with value | |
- MappedFieldType ft = new TextFieldMapper.Builder("med_freq", createDefaultIndexAnalyzers()).fielddata(true) | |
+ MappedFieldType ft = new TextFieldMapper.Builder("med_freq", createDefaultIndexAnalyzers(), false).fielddata(true) | |
.fielddataFrequencyFilter(random.nextBoolean() ? 101 : 101d / 200.0d, Integer.MAX_VALUE, 101) | |
.build(builderContext) | |
.fieldType(); | |
@@ -98,7 +98,7 @@ | |
{ | |
indexService.clearCaches(false, true); | |
- MappedFieldType ft = new TextFieldMapper.Builder("med_freq", createDefaultIndexAnalyzers()).fielddata(true) | |
+ MappedFieldType ft = new TextFieldMapper.Builder("med_freq", createDefaultIndexAnalyzers(), false).fielddata(true) | |
.fielddataFrequencyFilter(random.nextBoolean() ? 101 : 101d / 200.0d, Integer.MAX_VALUE, 101) | |
.build(builderContext) | |
.fieldType(); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment