Skip to content

Commit caaac1c

Browse files
committed
Do not merge passthrough time series dimension mappers
1 parent 5b9a9ba commit caaac1c

File tree

1 file changed

+11
-1
lines changed

1 file changed

+11
-1
lines changed

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

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -227,7 +227,7 @@ protected final Map<String, Mapper> buildMappers(MapperBuilderContext mapperBuil
227227
for (Mapper.Builder builder : mappersBuilders) {
228228
Mapper mapper = builder.build(mapperBuilderContext);
229229
Mapper existing = mappers.get(mapper.leafName());
230-
if (existing != null) {
230+
if (existing != null && isPassThroughTimeSeriesDimension(mapper) == false) {
231231
// The same mappings or document may hold the same field twice, either because duplicated JSON keys are allowed or
232232
// the same field is provided using the object notation as well as the dot notation at the same time.
233233
// This can also happen due to multiple index templates being merged into a single mappings definition using
@@ -245,6 +245,16 @@ protected final Map<String, Mapper> buildMappers(MapperBuilderContext mapperBuil
245245
return mappers;
246246
}
247247

248+
/**
249+
* Pass through dimensions might be used in the index.routing_path so they should not be merged with existing field mappings
250+
*/
251+
private boolean isPassThroughTimeSeriesDimension(Mapper mapper) {
252+
if (mapper instanceof PassThroughObjectMapper passThroughObjectMapper) {
253+
return passThroughObjectMapper.containsDimensions();
254+
}
255+
return false;
256+
}
257+
248258
@Override
249259
public ObjectMapper build(MapperBuilderContext context) {
250260
return new ObjectMapper(

0 commit comments

Comments
 (0)