LosD commented on a change in pull request #229: Upgrade to Elasticsearch 7.3.1 URL: https://github.com/apache/metamodel/pull/229#discussion_r338759752
########## File path: elasticsearch/rest/src/main/java/org/apache/metamodel/elasticsearch/rest/ElasticSearchRestDataContext.java ########## @@ -133,21 +142,24 @@ public ElasticSearchRestDataContext(final ElasticSearchRestClient client, String final List<SimpleTableDef> result = new ArrayList<>(); if (mappings.isEmpty()) { - logger.warn("No metadata returned for index name '{}' - no tables will be detected."); + logger.warn("No metadata returned for index name '{}' - no tables will be detected.", indexName); } else { - for (Entry<String, Object> mapping : mappings) { - final String documentType = mapping.getKey(); - - @SuppressWarnings("unchecked") - Map<String, Object> mappingConfiguration = (Map<String, Object>) mapping.getValue(); + for (final Entry<String, MappingMetaData> mapping : mappings.entrySet()) { + final String tableName = mapping.getValue().type(); + final Map<String, Object> mappingConfiguration = mapping.getValue().getSourceAsMap(); + @SuppressWarnings("unchecked") - Map<String, Object> properties = (Map<String, Object>) mappingConfiguration.get("properties"); - - try { - final SimpleTableDef table = detectTable(properties, documentType); - result.add(table); - } catch (Exception e) { - logger.error("Unexpected error during detectTable for document type '{}'", documentType, e); + final Map<String, Object> properties = (Map<String, Object>) mappingConfiguration.get(ElasticSearchMetaData.PROPERTIES_KEY); + + if (properties != null) { + try { + final SimpleTableDef table = detectTable(properties, tableName); + result.add(table); + } catch (Exception e) { + logger + .error("Unexpected error during detectTable for document mapping type '{}'", tableName, Review comment: Just cosmetic, but this looks rather odd. Is this really how it's supposed to be formatted? ---------------------------------------------------------------- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. For queries about this service, please contact Infrastructure at: us...@infra.apache.org With regards, Apache Git Services