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

 ##########
 File path: 
elasticsearch/rest/src/main/java/org/apache/metamodel/elasticsearch/rest/ElasticSearchRestDataSet.java
 ##########
 @@ -50,12 +50,15 @@ public ElasticSearchRestDataSet(final RestHighLevelClient 
client, final SearchRe
     @Override
     public void closeNow() {
         final String scrollId = _searchResponse.getScrollId();
-        final ClearScrollRequest clearScrollRequest = new ClearScrollRequest();
-        clearScrollRequest.addScrollId(scrollId);
-        try {
-            client.clearScroll((ClearScrollRequest) clearScrollRequest, 
RequestOptions.DEFAULT);
-        } catch (IOException e) {
-            logger.warn("Could not clear scroll.", e);
+        
+        if (scrollId != null) {
+            final ClearScrollRequest clearScrollRequest = new 
ClearScrollRequest();
+            clearScrollRequest.addScrollId(scrollId);
+            try {
+                client.clearScroll((ClearScrollRequest) clearScrollRequest, 
RequestOptions.DEFAULT);
+            } catch (final IOException e) {
+                logger.warn("Could not clear scroll.", e);
+            }
 
 Review comment:
   A bit out of scope, but looking at the `DeleteAndInsertBuilder`, if a 
run-time exception occurs somewhere in the logic invoked on line 61, we're 
essentially losing data, because the data which has been deleted won't be 
reinserted. Am I correct here?

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