mirror of
https://github.com/elastic/elasticsearch.git
synced 2025-04-25 07:37:19 -04:00
Don't generate mappings that copy_to into itself (#119997)
This commit is contained in:
parent
a620e7c976
commit
e7a9690186
1 changed files with 5 additions and 5 deletions
|
@ -101,11 +101,6 @@ public class MappingGenerator {
|
||||||
}
|
}
|
||||||
|
|
||||||
if (templateEntry instanceof Template.Leaf leaf) {
|
if (templateEntry instanceof Template.Leaf leaf) {
|
||||||
// For simplicity we only copy to keyword fields, synthetic source logic to handle copy_to is generic.
|
|
||||||
if (leaf.type() == FieldType.KEYWORD) {
|
|
||||||
context.addCopyToCandidate(fieldName);
|
|
||||||
}
|
|
||||||
|
|
||||||
var mappingParametersGenerator = specification.dataSource()
|
var mappingParametersGenerator = specification.dataSource()
|
||||||
.get(
|
.get(
|
||||||
new DataSourceRequest.LeafMappingParametersGenerator(
|
new DataSourceRequest.LeafMappingParametersGenerator(
|
||||||
|
@ -120,6 +115,11 @@ public class MappingGenerator {
|
||||||
mappingParameters.put("type", leaf.type().toString());
|
mappingParameters.put("type", leaf.type().toString());
|
||||||
mappingParameters.putAll(mappingParametersGenerator.get());
|
mappingParameters.putAll(mappingParametersGenerator.get());
|
||||||
|
|
||||||
|
// For simplicity we only copy to keyword fields, synthetic source logic to handle copy_to is generic.
|
||||||
|
if (leaf.type() == FieldType.KEYWORD) {
|
||||||
|
context.addCopyToCandidate(fieldName);
|
||||||
|
}
|
||||||
|
|
||||||
} else if (templateEntry instanceof Template.Object object) {
|
} else if (templateEntry instanceof Template.Object object) {
|
||||||
var mappingParametersGenerator = specification.dataSource()
|
var mappingParametersGenerator = specification.dataSource()
|
||||||
.get(new DataSourceRequest.ObjectMappingParametersGenerator(false, object.nested(), context.parentSubobjects()))
|
.get(new DataSourceRequest.ObjectMappingParametersGenerator(false, object.nested(), context.parentSubobjects()))
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue