jhorcicka commented on a change in pull request #229: Upgrade to Elasticsearch 
7.3.1
URL: https://github.com/apache/metamodel/pull/229#discussion_r331909686
 
 

 ##########
 File path: 
elasticsearch/rest/src/main/java/org/apache/metamodel/elasticsearch/rest/ElasticSearchRestDataContext.java
 ##########
 @@ -133,13 +142,12 @@ 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 documentType = mapping.getValue().type();
 
 Review comment:
   This `documentType` variable is in the end used as a "table name". I find 
the naming a bit confusing. Current situation makes me think it has to do 
something with deprecated "mapping types". 
   
   I know there are no real "tables" in ES, but since this is already used e. 
g. in "SimpleTableDef", I'd rather have it consistent. 
   
   I suggest to rename `documentType` on this line, and also the parameter name 
of `detectTable` method, which, by the way, calls the document type an index 
type. 
   
   Document type VS. index type VS. index name VS. table name VS. mapping type. 
   
   Perhaps I just lack ES terms being used here. :-) Then just ignore this 
comment. 
   
   
![01](https://user-images.githubusercontent.com/13213915/66297802-ab956300-e8f0-11e9-9491-c10ea686fedb.png)
   
   
![02](https://user-images.githubusercontent.com/13213915/66297803-ab956300-e8f0-11e9-9a84-f0a9a9d5f838.png)
   
   
![03](https://user-images.githubusercontent.com/13213915/66297804-ac2df980-e8f0-11e9-93ae-4da05e1bb496.png)
   

----------------------------------------------------------------
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

Reply via email to