Hits + query_cache=true + aggs in 1 round trip: _msearch?

Hello, All -

I'd like to benefit from query cache of aggregations when possible AND get hits AND aggregations in a single round trip. It occurred to me, I can just run a pair of related queries against _msearch where one is for aggregations (still filtered by a query, but ignoring its hits (search_type=count)) and the other is just the query (no aggregations). Basically, just to work around the current limitation that query_cache=true requires search_type=count (https://www.elastic.co/guide/en/elasticsearch/reference/1.7/index-modules-shard-query-cache.html).

e.g., send _msearch

{"index" : "some_index", "search_type": "count", "query_cache": true}
{ ...query with aggs for the aggs... }
{"index" : "some_index"}
{ ...same query without aggs for the hits... }

This seems to work but feels contorted. Is there an easier thing I should be doing instead? (e.g., "index.cache.query.enable": true or something?) (currently on es 1.7.4)

Please advise,

  • Luke

Some renames, but looks like this would still work in 2.x https://www.elastic.co/guide/en/elasticsearch/reference/current/shard-request-cache.html with size=0 and request_cache=true

Elasticsearch devs this seems to net a significant improvement for us: is that a surprise ? Are there downsides?