# Use search results as base for another search

**URL:** <https://discuss.elastic.co/t/use-search-results-as-base-for-another-search/20320>\
**Category:** Elasticsearch\
**Created:** [October 19, 2014, 9:02am UTC](https://discuss.elastic.co/t/use-search-results-as-base-for-another-search/20320 "2014-10-19T09:02:07Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![tsakirgil](https://avatars.discourse-cdn.com/v4/letter/t/ecb155/32.png) [@tsakirgil](https://discuss.elastic.co/u/tsakirgil)\
**Post date:** [October 19, 2014, 9:02am UTC](https://discuss.elastic.co/t/use-search-results-as-base-for-another-search/20320/1 "2014-10-19T09:02:07Z")

</div>

Hello,

I have an index where i store comments for articles

Document is like this  
{  
user\_name:  
field\_X:  
field\_Y:  
publish\_date:  
first\_post: keeps if that post was the first made by user  
}

What i want to do is to find all the users that are matching field\_X and field\_Y and made their first post during a given period.  
Base on that result i want to find the number of those users that have repost during another given period

First thing that comes in my mind is a two step search  
So i have two questions:  
a) I want to support large collection (thousands documents). How efficient is will be if i go with two step solution to add in second search thousands of term filters  
b) Is there a way to achieve that in one query

---

<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:** [July 6, 2017, 12:55am UTC](https://discuss.elastic.co/t/use-search-results-as-base-for-another-search/20320/2 "2017-07-06T00:55:16Z")

</div>


