stalary commented on a change in pull request #3454:
URL: https://github.com/apache/incubator-doris/pull/3454#discussion_r426244774



##########
File path: fe/src/main/java/org/apache/doris/external/EsStateStore.java
##########
@@ -130,74 +121,30 @@ public void loadTableFromCatalog() {
         }
     }
 
-    private EsTableState loadEsIndexMetadataV55(final EsTable esTable) {
-        OkHttpClient.Builder clientBuilder = new OkHttpClient.Builder();
-        clientBuilder.authenticator(new Authenticator() {
-            @Override
-            public Request authenticate(Route route, Response response) throws 
IOException {
-                String credential = Credentials.basic(esTable.getUserName(), 
esTable.getPasswd());
-                return response.request().newBuilder().header("Authorization", 
credential).build();
-            }
-        });
-        String[] seeds = esTable.getSeeds();
-        for (String seed : seeds) {
-            String url = seed + "/_cluster/state?indices="
-                    + esTable.getIndexName()
-                    + 
"&metric=routing_table,nodes,metadata&expand_wildcards=open";
-            String basicAuth = "";
-            try {
-                Request request = new Request.Builder()
-                        .get()
-                        .url(url)
-                        .addHeader("Authorization", basicAuth)
-                        .build();
-                Call call = clientBuilder.build().newCall(request);
-                Response response = call.execute();
-                String responseStr = response.body().string();
-                if (response.isSuccessful()) {
-                    try {
-                        EsTableState esTableState = 
parseClusterState55(responseStr, esTable);
-                        if (esTableState != null) {
-                            return esTableState;
-                        }
-                    } catch (Exception e) {
-                        LOG.warn("errors while parse response msg {}", 
responseStr, e);
-                    }
-                } else {
-                    LOG.info("errors while call es [{}] to get state info {}", 
url, responseStr);
-                }
-            } catch (Exception e) {
-                LOG.warn("errors while call es [{}]", url, e);
-            }
-        }
-        return null;
-    }
-
-    @VisibleForTesting
-    public EsTableState parseClusterState55(String responseStr, EsTable 
esTable)
-            throws DdlException, AnalysisException, 
ExternalDataSourceException {
-        JSONObject jsonObject = new JSONObject(responseStr);
-        String clusterName = jsonObject.getString("cluster_name");
-        JSONObject nodesMap = jsonObject.getJSONObject("nodes");
-        // we build the doc value context for fields maybe used for scanning
-        // "properties": {
-        //      "city": {
-        //        "type": "text", // text field does not have docvalue
-        //        "fields": {
-        //          "raw": {
-        //            "type":  "keyword"
-        //          }
-        //        }
-        //      }
-        //    }
-        // then the docvalue context provided the mapping between the select 
field and real request field :
-        // {"city": "city.raw"}
-        JSONObject indicesMetaMap = 
jsonObject.getJSONObject("metadata").getJSONObject("indices");
-        JSONObject indexMetaMap = 
indicesMetaMap.optJSONObject(esTable.getIndexName());
-        if (indexMetaMap != null && (esTable.isKeywordSniffEnable() || 
esTable.isDocValueScanEnable())) {
-            JSONObject mappings = indexMetaMap.optJSONObject("mappings");
+    // Configure keyword and doc_values by mapping
+    public void loadEsIndexMapping(String indexMapping, EsTable esTable) {
+        JSONObject jsonObject = new JSONObject(indexMapping);

Review comment:
       ok




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



---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscr...@doris.apache.org
For additional commands, e-mail: commits-h...@doris.apache.org

Reply via email to