Skip to content

Commit

Permalink
iter
Browse files Browse the repository at this point in the history
  • Loading branch information
jimczi committed Nov 30, 2024
1 parent 5ab3e35 commit 9acf74d
Showing 1 changed file with 6 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -75,8 +75,12 @@ protected void parseCreateField(DocumentParserContext context) throws IOExceptio
while (parser.nextToken() != XContentParser.Token.END_OBJECT) {
XContentParserUtils.ensureExpectedToken(XContentParser.Token.FIELD_NAME, parser.currentToken(), parser);
String fieldName = parser.currentName();
// TODO: Find the leaf field under objects
Mapper mapper = context.mappingLookup().getMapper(fieldName);
var parent = context.parent().findParentMapper(fieldName);
if (parent == null) {
throw new IllegalArgumentException("Illegal inference field [" + fieldName + "] found.");
}
String suffix = context.parent() != parent ? fieldName.substring(parent.fullPath().length() + 1) : fieldName;
var mapper = parent.getMapper(suffix);
if (mapper != null && mapper instanceof InferenceFieldMapper && mapper instanceof FieldMapper fieldMapper) {
fieldMapper.parseCreateField(new DocumentParserContext.Wrapper(context.parent(), context) {
@Override
Expand Down

0 comments on commit 9acf74d

Please sign in to comment.