Issue spotted here: https://github.com/hibernate/hibernate-search/pull/1217/commits/dfc7f199358808397d144d79d89f7915851db222#r87074164 Right now, we're only logging debug messages when failing to add a property/field to the ES mapping:
for ( DocumentFieldMetadata fieldMetadata : typeMetadata.getNonEmbeddedDocumentFieldMetadata() ) {
try {
addPropertyMapping( mappingBuilder, fieldMetadata );
}
catch (IncompleteDataException e) {
LOG.debug( "Not adding a mapping for field " + fieldMetadata.getAbsoluteName() + " because of incomplete data", e );
}
}
for ( BridgeDefinedField bridgeDefinedField : getNonEmbeddedBridgeDefinedFields( typeMetadata ) ) {
try {
addPropertyMapping( mappingBuilder, bridgeDefinedField );
}
catch (IncompleteDataException e) {
LOG.debug( "Not adding a mapping for field " + bridgeDefinedField.getAbsoluteName() + " because of incomplete data", e );
}
}
....
for ( FacetMetadata facetMetadata : fieldMetadata.getFacetMetadata() ) {
try {
addFieldMapping( propertyMapping, mappingBuilder, facetMetadata );
}
catch (IncompleteDataException e) {
LOG.debug( "Not adding a mapping for facet " + facetMetadata.getAbsoluteName() + " because of incomplete data", e );
}
}
The only way to get IncompleteDataException can be found in addTypeOptions:
...
break;
case UNKNOWN_NUMERIC:
elasticsearchType = null;
break;
case STRING:
case UNKNOWN:
default:
elasticsearchType = DataType.STRING;
break;
}
if ( elasticsearchType == null ) {
throw new IncompleteDataException( "Field type could not be determined" );
}
While I understand that we might not want to make the mapping generation fail completely (so that users may test more easily), at least we should issue a warning. Or maybe even log an error. Something to be considered: Sanne Grinovero expressed concerned about issuing warnings, since in some enterprises they are considered blocking when putting applications in production. I feel like one of the purposes of warnings is to inform users about potential error, and leave it to the user to decide if it's bad or not. So in this case, it would be exactly what we need. Now, if it's blocking for some users... Guillaume Smet, Sanne Grinovero, WDYT? |