Mapping: dynamic flag is explicitly returned even when not set

fixes #2789
This commit is contained in:
Shay Banon 2013-03-16 01:29:22 +01:00
parent c25eb7defe
commit 111a13222e
1 changed files with 5 additions and 1 deletions

View File

@ -532,7 +532,11 @@ public class ObjectMapper implements Mapper, AllFieldMapper.IncludeInAll {
context.path().remove();
Mapper.Builder builder = context.root().findTemplateBuilder(context, currentFieldName, "object");
if (builder == null) {
builder = MapperBuilders.object(currentFieldName).enabled(true).dynamic(dynamic).pathType(pathType);
builder = MapperBuilders.object(currentFieldName).enabled(true).pathType(pathType);
// if this is a non root object, then explicitly set the dynamic behavior if set
if (!(this instanceof RootObjectMapper) && this.dynamic != Defaults.DYNAMIC) {
((Builder) builder).dynamic(this.dynamic);
}
}
BuilderContext builderContext = new BuilderContext(context.indexSettings(), context.path());
objectMapper = builder.build(builderContext);