Skip to content

Commit e7a9690

Browse files
authored
Don't generate mappings that copy_to into itself (#119997)
1 parent a620e7c commit e7a9690

File tree

1 file changed

+5
-5
lines changed

1 file changed

+5
-5
lines changed

test/framework/src/main/java/org/elasticsearch/logsdb/datageneration/MappingGenerator.java

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -101,11 +101,6 @@ private void generateMapping(
101101
}
102102

103103
if (templateEntry instanceof Template.Leaf leaf) {
104-
// For simplicity we only copy to keyword fields, synthetic source logic to handle copy_to is generic.
105-
if (leaf.type() == FieldType.KEYWORD) {
106-
context.addCopyToCandidate(fieldName);
107-
}
108-
109104
var mappingParametersGenerator = specification.dataSource()
110105
.get(
111106
new DataSourceRequest.LeafMappingParametersGenerator(
@@ -120,6 +115,11 @@ private void generateMapping(
120115
mappingParameters.put("type", leaf.type().toString());
121116
mappingParameters.putAll(mappingParametersGenerator.get());
122117

118+
// For simplicity we only copy to keyword fields, synthetic source logic to handle copy_to is generic.
119+
if (leaf.type() == FieldType.KEYWORD) {
120+
context.addCopyToCandidate(fieldName);
121+
}
122+
123123
} else if (templateEntry instanceof Template.Object object) {
124124
var mappingParametersGenerator = specification.dataSource()
125125
.get(new DataSourceRequest.ObjectMappingParametersGenerator(false, object.nested(), context.parentSubobjects()))

0 commit comments

Comments
 (0)