LosD commented on a change in pull request #229: Upgrade to Elasticsearch 7.3.1
URL: https://github.com/apache/metamodel/pull/229#discussion_r336521302
##########
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:
Ouch. Rock, meet hard place. I agree, working correctly trumps performance,
and it sounds like a big change.
----------------------------------------------------------------
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:
[email protected]
With regards,
Apache Git Services