Copilot commented on code in PR #9161:
URL: https://github.com/apache/seatunnel/pull/9161#discussion_r2041071025


##########
seatunnel-connectors-v2/connector-elasticsearch/src/main/java/org/apache/seatunnel/connectors/seatunnel/elasticsearch/source/ElasticsearchSourceSplitEnumerator.java:
##########
@@ -201,4 +204,30 @@ public ElasticsearchSourceState snapshotState(long 
checkpointId) throws Exceptio
 
     @Override
     public void notifyCheckpointComplete(long checkpointId) throws Exception {}
+
+    public List<IndexDocsCount> getIndexDocsCount(String index) {
+        List<String> hosts = connConfig.get(ElasticsearchBaseOptions.HOSTS);
+        String endpoint =
+                String.format(
+                        "%s/_cat/indices/%s?h=index,docsCount&format=json", 
hosts.get(0), index);
+        HttpClientUtil httpClientUtil = new HttpClientUtil();

Review Comment:
   [nitpick] Repeatedly instantiating HttpClientUtil and creating a new 
CloseableHttpClient for each request might introduce performance overhead; 
consider reusing a client instance if multiple requests are expected.



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

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to