Is there any query + aggregation capable plugin available


Rest query to elastic that has first query which reduces hits that are directed to aggs works wonderfully in elastic.
But I haven't find any export utility plugin in elastic or in logstash that would make same kind of query+aggs -query and JSON parsing to eg. csv
Current export plugins seems to be capable only for simple queries which don't include aggs.
If I have missed some feature in current plugins then give me a tip.