LosD commented on a change in pull request #229: Upgrade to Elasticsearch 7.3.1 URL: https://github.com/apache/metamodel/pull/229#discussion_r336532315
########## 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: Yeah, I think so, but that's more or less life without transactions. It can't really be done the other way (inserts before deletes) AFAIK, because indexes of the unique type would get angry. ---------------------------------------------------------------- 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