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@f6819a32b8
This commit is contained in:
Nik Everett 2017-12-18 13:57:58 -05:00
parent 4680e1e166
commit 021e8dd111
1 changed files with 2 additions and 4 deletions

View File

@ -86,14 +86,12 @@ public class Scroller {
} }
SearchRequest search = client.prepareSearch(index).setSource(sourceBuilder).request(); SearchRequest search = client.prepareSearch(index).setSource(sourceBuilder).request();
search.scroll(keepAlive).source().timeout(timeout);
boolean isAggsOnly = query.isAggsOnly();
ScrollerActionListener l; ScrollerActionListener l;
if (isAggsOnly) { if (query.isAggsOnly()) {
l = new AggsScrollActionListener(listener, client, timeout, schema, query); l = new AggsScrollActionListener(listener, client, timeout, schema, query);
} else { } else {
search.scroll(keepAlive).source().timeout(timeout);
l = new HandshakeScrollActionListener(listener, client, timeout, schema, query); l = new HandshakeScrollActionListener(listener, client, timeout, schema, query);
} }
client.search(search, l); client.search(search, l);