# Limit result from category based on result count from other category

**URL:** https://discuss.elastic.co/t/limit-result-from-category-based-on-result-count-from-other-category/60467
**Category:** Elasticsearch
**Created:** [September 14, 2016, 8:18am UTC](https://discuss.elastic.co/t/limit-result-from-category-based-on-result-count-from-other-category/60467 "2016-09-14T08:18:51Z")
**Posts on this page:** 3
**Page:** 1

<div class="post-metadata">

### Author: ![habtim](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/habtim/32/11895_2.png) [@habtim](https://discuss.elastic.co/u/habtim)
#### Post date: [September 14, 2016, 8:18am UTC](https://discuss.elastic.co/t/limit-result-from-category-based-on-result-count-from-other-category/60467/1 "2016-09-14T08:18:51Z")

</div>

Hello everyone,

I have a pretty specific question for Elasticsearch and I currently don't know how to solve this.  
For example I have two categories 1: Q&A - 2: articles, and when you search for a specific term the search page results will be flooded with Q&A, this is not what we want and we want to accomplish the following:

For each three articles we want to allow 1 Q&A.  
So for example when we have 18 articles in the search we want to allow 6 Q&A results.

Anyone has any idea how to do this?

---

<div class="post-metadata">

### Author: ![cbuescher](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/cbuescher/32/60402_2.png) [@cbuescher](https://discuss.elastic.co/u/cbuescher)
#### Post date: [September 14, 2016, 9:01am UTC](https://discuss.elastic.co/t/limit-result-from-category-based-on-result-count-from-other-category/60467/2 "2016-09-14T09:01:32Z")

</div>

As far as I know you can only have these hard limits with two searches, each filtered by one of the categories.

---

<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 5, 2017, 10:20pm UTC](https://discuss.elastic.co/t/limit-result-from-category-based-on-result-count-from-other-category/60467/3 "2017-07-05T22:20:23Z")

</div>


