From 021e8dd1111263ee56bfd22344e6d0edd69a0df1 Mon Sep 17 00:00:00 2001 From: Nik Everett Date: Mon, 18 Dec 2017 13:57:58 -0500 Subject: [PATCH] SQL: Don't put aggs only queries into scroll context SQL was adding scroll timeouts to aggregation only queries. At best this is just confusing because we never scroll these queries. It *might* leave behind a scroll context that we don't want. It is failing some new validation that says that we have to have a `size` for every scroll query. Anyway, the simplest thing to do is to not put a scroll on aggregation only queries. Original commit: elastic/x-pack-elasticsearch@f6819a32b82eb411d7be9c9c9fab6793568146b1 --- .../elasticsearch/xpack/sql/execution/search/Scroller.java | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/sql/server/src/main/java/org/elasticsearch/xpack/sql/execution/search/Scroller.java b/sql/server/src/main/java/org/elasticsearch/xpack/sql/execution/search/Scroller.java index 978ceced06b..5922de72c12 100644 --- a/sql/server/src/main/java/org/elasticsearch/xpack/sql/execution/search/Scroller.java +++ b/sql/server/src/main/java/org/elasticsearch/xpack/sql/execution/search/Scroller.java @@ -86,14 +86,12 @@ public class Scroller { } SearchRequest search = client.prepareSearch(index).setSource(sourceBuilder).request(); - search.scroll(keepAlive).source().timeout(timeout); - - boolean isAggsOnly = query.isAggsOnly(); ScrollerActionListener l; - if (isAggsOnly) { + if (query.isAggsOnly()) { l = new AggsScrollActionListener(listener, client, timeout, schema, query); } else { + search.scroll(keepAlive).source().timeout(timeout); l = new HandshakeScrollActionListener(listener, client, timeout, schema, query); } client.search(search, l);