|
@@ -273,8 +273,12 @@ public class MapperService extends AbstractIndexComponent implements Closeable {
|
|
if (Version.indexCreated(indexSettings).onOrAfter(Version.V_2_0_0_beta1) && mapper.type().equals(mapper.parentFieldMapper().type())) {
|
|
if (Version.indexCreated(indexSettings).onOrAfter(Version.V_2_0_0_beta1) && mapper.type().equals(mapper.parentFieldMapper().type())) {
|
|
throw new IllegalArgumentException("The [_parent.type] option can't point to the same type");
|
|
throw new IllegalArgumentException("The [_parent.type] option can't point to the same type");
|
|
}
|
|
}
|
|
- if (mapper.type().contains(".") && !PercolatorService.TYPE_NAME.equals(mapper.type())) {
|
|
|
|
- logger.warn("Type [{}] contains a '.', it is recommended not to include it within a type name", mapper.type());
|
|
|
|
|
|
+ if (typeNameStartsWithIllegalDot(mapper)) {
|
|
|
|
+ if (Version.indexCreated(indexSettings).onOrAfter(Version.V_2_0_0_beta1)) {
|
|
|
|
+ throw new IllegalArgumentException("mapping type name [" + mapper.type() + "] must not start with a '.'");
|
|
|
|
+ } else {
|
|
|
|
+ logger.warn("Type [{}] starts with a '.', it is recommended not to start a type name with a '.'", mapper.type());
|
|
|
|
+ }
|
|
}
|
|
}
|
|
// we can add new field/object mappers while the old ones are there
|
|
// we can add new field/object mappers while the old ones are there
|
|
// since we get new instances of those, and when we remove, we remove
|
|
// since we get new instances of those, and when we remove, we remove
|
|
@@ -316,6 +320,10 @@ public class MapperService extends AbstractIndexComponent implements Closeable {
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
|
|
|
|
+ private boolean typeNameStartsWithIllegalDot(DocumentMapper mapper) {
|
|
|
|
+ return mapper.type().startsWith(".") && !PercolatorService.TYPE_NAME.equals(mapper.type());
|
|
|
|
+ }
|
|
|
|
+
|
|
private boolean assertSerialization(DocumentMapper mapper) {
|
|
private boolean assertSerialization(DocumentMapper mapper) {
|
|
// capture the source now, it may change due to concurrent parsing
|
|
// capture the source now, it may change due to concurrent parsing
|
|
final CompressedXContent mappingSource = mapper.mappingSource();
|
|
final CompressedXContent mappingSource = mapper.mappingSource();
|