# Is this type of query possible in one go?

**URL:** <https://discuss.elastic.co/t/is-this-type-of-query-possible-in-one-go/194275>\
**Category:** Elasticsearch\
**Created:** [August 7, 2019, 3:43pm UTC](https://discuss.elastic.co/t/is-this-type-of-query-possible-in-one-go/194275 "2019-08-07T15:43:20Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![Jason\_Baumgartner](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/jason_baumgartner/32/92716_2.png) [@Jason\_Baumgartner](https://discuss.elastic.co/u/Jason_Baumgartner)\
**Post date:** [August 7, 2019, 3:43pm UTC](https://discuss.elastic.co/t/is-this-type-of-query-possible-in-one-go/194275/1 "2019-08-07T15:43:21Z")

</div>

I am working with reddit comments and want to extract bots for analysis. What I'd like to do is:

1. Find all unique authors where the comment reply\_delay is less than a specific value. Example:

`curl -s -H "Content-Type: application/json" -XGET 'localhost:9200/rc/_search?q=reply_delay:<1' -d '{"size":0,"aggs":{"authors":{"terms":{"field":"author.keyword"}}}}'`

1. From this set of authors, I want to pull all documents matching for those authors and then use that document set for new aggregations.

So essentially I'm trying to:

1. Use a query to limit the initial document set and run a terms query on that.
2. From that aggregation, I want to build a new document set that I can use additional aggregations against.

Is this a pipeline? Is this even possible?

---

<div class="post-metadata">

**Author:** ![system](https://us1.discourse-cdn.com/elastic/original/3X/1/a/1ac57faf039f6b580b3f104ef42a2a89e41014de.png) [@system](https://discuss.elastic.co/u/system)\
**Post date:** [September 4, 2019, 3:43pm UTC](https://discuss.elastic.co/t/is-this-type-of-query-possible-in-one-go/194275/2 "2019-09-04T15:43:34Z")

</div>

Closed on September 4, 2019, 3:43pm UTC

This topic was automatically closed 28 days after the last reply. New replies are no longer allowed.
