Source:
private void mapEntity(XContentBuilder builder, @Nullable ElasticsearchPersistentEntity entity, boolean isRootObject, String nestedObjectFieldName, boolean nestedOrObjectField, FieldType fieldType, @Nullable Field parentFieldAnnotation, @Nullable DynamicMapping dynamicMapping) throws IOException { boolean writeNestedProperties = !isRootObject && (isAnyPropertyAnnotatedWithField(entity) || nestedOrObjectField); if (writeNestedProperties) { String type = nestedOrObjectField ? fieldType.toString().toLowerCase() : FieldType.Object.toString().toLowerCase(); builder.startObject(nestedObjectFieldName).field(FIELD_PARAM_TYPE, type); if (nestedOrObjectField && FieldType.Nested == fieldType && parentFieldAnnotation != null && parentFieldAnnotation.includeInParent()) { builder.field("include_in_parent", parentFieldAnnotation.includeInParent()); } } if (dynamicMapping != null) { builder.field(TYPE_DYNAMIC, dynamicMapping.value().name().toLowerCase()); } builder.startObject(FIELD_PROPERTIES); if (entity != null) { entity.doWithProperties((PropertyHandler<ElasticsearchPersistentProperty>) property -> { try { if (property.isAnnotationPresent(Transient.class) || isInIgnoreFields(property, parentFieldAnnotation)) { return; } if (property.isSeqNoPrimaryTermProperty()) { logger.warn("Property of is annotated for inclusion in mapping, but its type is " + "SeqNoPrimaryTerm that is never mapped, so it is skipped", property.getFieldName(), entity.getType()); return; } buildPropertyMapping(builder, isRootObject, property); } catch (IOException e) { logger.warn("error mapping property with name {}", property.getName(), e); } }); } builder.endObject(); if (writeNestedProperties) { builder.endObject(); } }

Target:
private void mapEntity(XContentBuilder builder, @Nullable ElasticsearchPersistentEntity entity, boolean isRootObject, String nestedObjectFieldName, boolean nestedOrObjectField, FieldType fieldType, @Nullable Field parentFieldAnnotation, @Nullable DynamicMapping dynamicMapping) throws IOException { boolean writeNestedProperties = !isRootObject && (isAnyPropertyAnnotatedWithField(entity) || nestedOrObjectField); if (writeNestedProperties) { String type = nestedOrObjectField ? fieldType.toString().toLowerCase() : FieldType.Object.toString().toLowerCase(); builder.startObject(nestedObjectFieldName).field(FIELD_PARAM_TYPE, type); if (nestedOrObjectField && FieldType.Nested == fieldType && parentFieldAnnotation != null && parentFieldAnnotation.includeInParent()) { builder.field("include_in_parent", parentFieldAnnotation.includeInParent()); } } if (dynamicMapping != null) { builder.field(TYPE_DYNAMIC, dynamicMapping.value().name().toLowerCase()); } builder.startObject(FIELD_PROPERTIES); if (entity != null) { entity.doWithProperties((PropertyHandler<ElasticsearchPersistentProperty>) property -> { try { if (property.isAnnotationPresent(Transient.class) || isInIgnoreFields(property, parentFieldAnnotation)) { return; } if (property.isSeqNoPrimaryTermProperty()) { if (property.isAnnotationPresent(Field.class)) { logger.warn("Property of is annotated for inclusion in mapping, but its type is " + "SeqNoPrimaryTerm that is never mapped, so it is skipped", property.getFieldName(), entity.getType()); } return; } buildPropertyMapping(builder, isRootObject, property); } catch (IOException e) { logger.warn("error mapping property with name {}", property.getName(), e); } }); } builder.endObject(); if (writeNestedProperties) { builder.endObject(); } }