better support for "embedded" token types (binaries) when parsing
This commit is contained in:
parent
e827c56be4
commit
1f250ede50
|
@ -187,6 +187,8 @@ public class XContentHelper {
|
|||
case VALUE_NULL:
|
||||
generator.writeNull();
|
||||
break;
|
||||
case VALUE_EMBEDDED_OBJECT:
|
||||
generator.writeBinary(parser.binaryValue());
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -107,6 +107,8 @@ public class XContentMapConverter {
|
|||
return readMap(parser, mapFactory);
|
||||
} else if (t == XContentParser.Token.START_ARRAY) {
|
||||
return readList(parser, mapFactory, t);
|
||||
} else if (t == XContentParser.Token.VALUE_EMBEDDED_OBJECT) {
|
||||
return parser.binaryValue();
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
|
|
@ -736,6 +736,12 @@ public class ObjectMapper implements Mapper, AllFieldMapper.IncludeInAll {
|
|||
builder = booleanField(currentFieldName);
|
||||
}
|
||||
mapper = builder.build(builderContext);
|
||||
} else if (token == XContentParser.Token.VALUE_EMBEDDED_OBJECT) {
|
||||
Mapper.Builder builder = context.root().findTemplateBuilder(context, currentFieldName, "binary");
|
||||
if (builder == null) {
|
||||
builder = binaryField(currentFieldName);
|
||||
}
|
||||
mapper = builder.build(builderContext);
|
||||
} else {
|
||||
Mapper.Builder builder = context.root().findTemplateBuilder(context, currentFieldName, null);
|
||||
if (builder != null) {
|
||||
|
|
Loading…
Reference in New Issue