private Map<String, String> reconcileFields(Map<String, String> detectedFields, Map<String, String> existingFields) {
        Map<String, String> result = new HashMap<>();
        Map<String, Map<String, String>> typeConflictResolution = loadTypeConflictResolution();
        
        // First add all fields that only exist in one of the maps
        for (Map.Entry<String, String> entry : detectedFields.entrySet()) {
            String fieldName = entry.getKey();
            if (!existingFields.containsKey(fieldName)) {
                result.put(fieldName, entry.getValue());
            }
        }
        
        for (Map.Entry<String, String> entry : existingFields.entrySet()) {
            String fieldName = entry.getKey();
            if (!detectedFields.containsKey(fieldName)) {
                result.put(fieldName, entry.getValue());
            }
        }
        
        // Now handle conflicts
        for (String fieldName : detectedFields.keySet()) {
            if (existingFields.containsKey(fieldName)) {
                String detectedFieldType = detectedFields.get(fieldName);
                String existingFieldType = existingFields.get(fieldName);
                
                if (detectedFieldType.equals(existingFieldType)) {
                    result.put(fieldName, detectedFieldType);
                } else {
                    logger.info("Resolving type conflict for field {} ({}) vs ({})", 
                                fieldName, detectedFieldType, existingFieldType);
                    String resolvedType = resolveTypeConflict(detectedFieldType, existingFieldType, typeConflictResolution);
                    if (resolvedType == null) {
                        logger.error("Cannot resolve type conflict for field {} ({}) vs ({})", 
                                        fieldName, detectedFieldType, existingFieldType);
                        logger.warn("Leaving field {} as is", fieldName);
                        result.put(fieldName, existingFieldType);
                    } else {
                        logger.info("Resolved type conflict for field {} ({}) vs ({}) to {}", 
                                    fieldName, detectedFieldType, existingFieldType, resolvedType);
                        result.put(fieldName, resolvedType);
                    }
                }
            }
        }
        
        return result;
    }
Reconciles the detected fields with the existing fields.

@param detectedFields The fields detected in the input data
@param existingFields The fields already defined in the application package
@return A map of reconciled fields
integration/logstash-plugins/logstash-output-vespa/src/main/java/org/logstashplugins/VespaAppPackageWriter.java