# Top N results with facet counts

**URL:** <https://discuss.elastic.co/t/top-n-results-with-facet-counts/8154>\
**Category:** Elasticsearch\
**Created:** [June 19, 2012, 12:49pm UTC](https://discuss.elastic.co/t/top-n-results-with-facet-counts/8154 "2012-06-19T12:49:37Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![ywtsang](https://avatars.discourse-cdn.com/v4/letter/y/a698b9/32.png) [@ywtsang](https://discuss.elastic.co/u/ywtsang)\
**Post date:** [June 19, 2012, 12:49pm UTC](https://discuss.elastic.co/t/top-n-results-with-facet-counts/8154/1 "2012-06-19T12:49:37Z")

</div>

Is it possible to limit the total matched results to top N (sorted by  
value provided at query) and the facet counts are only calculated  
based on this top N matched results?

Thanks,  
Wing

---

<div class="post-metadata">

**Author:** ![otisg](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/otisg/32/492_2.png) [@otisg](https://discuss.elastic.co/u/otisg)\
**Post date:** [June 19, 2012, 7:57pm UTC](https://discuss.elastic.co/t/top-n-results-with-facet-counts/8154/2 "2012-06-19T19:57:24Z")

</div>

I _think_ it's not, but if it is, I'd love to know, because we recently had  
a need for that.

## Otis

Search Analytics - [Cloud Monitoring Tools & Services | Sematext](http://sematext.com/search-analytics/index.html)  
Scalable Performance Monitoring - [Sematext Monitoring | Infrastructure Monitoring Service](http://sematext.com/spm/index.html)

On Tuesday, June 19, 2012 8:49:37 AM UTC-4, Yiu Wing TSANG wrote:

> Is it possible to limit the total matched results to top N (sorted by  
> value provided at query) and the facet counts are only calculated  
> based on this top N matched results?
> 
> Thanks,  
> Wing

---

<div class="post-metadata">

**Author:** ![kimchy](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/kimchy/32/44952_2.png) [@kimchy](https://discuss.elastic.co/u/kimchy)\
**Post date:** [June 21, 2012, 7:45am UTC](https://discuss.elastic.co/t/top-n-results-with-facet-counts/8154/3 "2012-06-21T07:45:01Z")

</div>

No, you can't do that. Though with the design of the facets, if shouldn't  
be hard to implement...

On Tue, Jun 19, 2012 at 9:57 PM, Otis Gospodnetic \<  
[otis.gospodnetic@gmail.com](mailto:otis.gospodnetic@gmail.com)\> wrote:

> I _think_ it's not, but if it is, I'd love to know, because we recently  
> had a need for that.
> 
> ## Otis
> 
> Search Analytics - [Cloud Monitoring Tools & Services | Sematext](http://sematext.com/search-analytics/index.html)  
> Scalable Performance Monitoring - [Sematext Monitoring | Infrastructure Monitoring Service](http://sematext.com/spm/index.html)
> 
> On Tuesday, June 19, 2012 8:49:37 AM UTC-4, Yiu Wing TSANG wrote:
> 
> > Is it possible to limit the total matched results to top N (sorted by  
> > value provided at query) and the facet counts are only calculated  
> > based on this top N matched results?
> > 
> > Thanks,  
> > Wing

---

<div class="post-metadata">

**Author:** ![Ivan](https://avatars.discourse-cdn.com/v4/letter/i/df788c/32.png) [@Ivan](https://discuss.elastic.co/u/Ivan)\
**Post date:** [July 20, 2012, 12:20am UTC](https://discuss.elastic.co/t/top-n-results-with-facet-counts/8154/4 "2012-07-20T00:20:29Z")

</div>

Was an issue ever created for this request? I now find myself needing  
this functionality.

--  
Ivan

On Thu, Jun 21, 2012 at 12:45 AM, Shay Banon [kimchy@gmail.com](mailto:kimchy@gmail.com) wrote:

> No, you can't do that. Though with the design of the facets, if shouldn't be  
> hard to implement...
> 
> On Tue, Jun 19, 2012 at 9:57 PM, Otis Gospodnetic  
> [otis.gospodnetic@gmail.com](mailto:otis.gospodnetic@gmail.com) wrote:
> 
> > I _think_ it's not, but if it is, I'd love to know, because we recently  
> > had a need for that.
> > 
> > ## Otis
> > 
> > Search Analytics - [Cloud Monitoring Tools & Services | Sematext](http://sematext.com/search-analytics/index.html)  
> > Scalable Performance Monitoring - [Sematext Monitoring | Infrastructure Monitoring Service](http://sematext.com/spm/index.html)
> > 
> > On Tuesday, June 19, 2012 8:49:37 AM UTC-4, Yiu Wing TSANG wrote:
> > 
> > > Is it possible to limit the total matched results to top N (sorted by  
> > > value provided at query) and the facet counts are only calculated  
> > > based on this top N matched results?
> > > 
> > > Thanks,  
> > > Wing

---

<div class="post-metadata">

**Author:** ![Ivan](https://avatars.discourse-cdn.com/v4/letter/i/df788c/32.png) [@Ivan](https://discuss.elastic.co/u/Ivan)\
**Post date:** [July 20, 2012, 12:28am UTC](https://discuss.elastic.co/t/top-n-results-with-facet-counts/8154/5 "2012-07-20T00:28:43Z")

</div>

Never mind, found it:

> <https://github.com/elastic/elasticsearch/issues/2040>
>
> See
> https://groups.google.com/d/msg/elasticsearch/OZsc5ofNhag/9JfwSy-CEMwJ where… Shay says "...with the design of the facets, if shouldn't be hard to implement..."

On Thu, Jul 19, 2012 at 5:20 PM, Ivan Brusic [ivan@brusic.com](mailto:ivan@brusic.com) wrote:

> Was an issue ever created for this request? I now find myself needing  
> this functionality.
> 
> --  
> Ivan
> 
> On Thu, Jun 21, 2012 at 12:45 AM, Shay Banon [kimchy@gmail.com](mailto:kimchy@gmail.com) wrote:
> 
> > No, you can't do that. Though with the design of the facets, if shouldn't be  
> > hard to implement...
> > 
> > On Tue, Jun 19, 2012 at 9:57 PM, Otis Gospodnetic  
> > [otis.gospodnetic@gmail.com](mailto:otis.gospodnetic@gmail.com) wrote:
> > 
> > > I _think_ it's not, but if it is, I'd love to know, because we recently  
> > > had a need for that.
> > > 
> > > ## Otis
> > > 
> > > Search Analytics - [Cloud Monitoring Tools & Services | Sematext](http://sematext.com/search-analytics/index.html)  
> > > Scalable Performance Monitoring - [Sematext Monitoring | Infrastructure Monitoring Service](http://sematext.com/spm/index.html)
> > > 
> > > On Tuesday, June 19, 2012 8:49:37 AM UTC-4, Yiu Wing TSANG wrote:
> > > 
> > > > Is it possible to limit the total matched results to top N (sorted by  
> > > > value provided at query) and the facet counts are only calculated  
> > > > based on this top N matched results?
> > > > 
> > > > Thanks,  
> > > > Wing

---

<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, 3:19am UTC](https://discuss.elastic.co/t/top-n-results-with-facet-counts/8154/6 "2017-07-06T03:19:45Z")

</div>


