# Getting the Facets for the Entire Response

**URL:** <https://discuss.elastic.co/t/getting-the-facets-for-the-entire-response/6996>\
**Category:** Elasticsearch\
**Created:** [March 14, 2012, 1:03pm UTC](https://discuss.elastic.co/t/getting-the-facets-for-the-entire-response/6996 "2012-03-14T13:03:02Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![vijuitech](https://avatars.discourse-cdn.com/v4/letter/v/bcef8e/32.png) [@vijuitech](https://discuss.elastic.co/u/vijuitech)\
**Post date:** [March 14, 2012, 1:03pm UTC](https://discuss.elastic.co/t/getting-the-facets-for-the-entire-response/6996/1 "2012-03-14T13:03:02Z")

</div>

Hi all,  
How can I get the facets of the whole response?

For Example

searchRequestBuilder.addFacet(FacetBuilders.termsFacet("namecount").field("name.namesort").size(10));

response = searchRequestBuilder.execute().actionGet();

Here am getting the facets for the first 10 data in the response. How  
can I get the facets for the all data in the whole response.

Cheers!!

George

---

<div class="post-metadata">

**Author:** ![dadoonet](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/dadoonet/32/137187_2.png) [@dadoonet](https://discuss.elastic.co/u/dadoonet)\
**Post date:** [March 14, 2012, 2:15pm UTC](https://discuss.elastic.co/t/getting-the-facets-for-the-entire-response/6996/2 "2012-03-14T14:15:31Z")

</div>

By default, facets are computed on the whole response.

I suggest to remove the .size(10).

HTH

Le 14 mars 2012 à 14:03, George Viju [vijuitech@gmail.com](mailto:vijuitech@gmail.com) a écrit :

> Hi all,  
> How can I get the facets of the whole response?
> 
> For Example

searchRequestBuilder.addFacet(FacetBuilders.termsFacet("namecount").field("name.namesort").size(10));

> response = searchRequestBuilder.execute().actionGet();
> 
> Here am getting the facets for the first 10 data in the response. How  
> can I get the facets for the all data in the whole response.
> 
> Cheers!!
> 
> George

--  
David Pilato  
[http://dev.david.pilato.fr/](http://dev.david.pilato.fr/)  
Twitter : @dadoonet

---

<div class="post-metadata">

**Author:** ![vijuitech](https://avatars.discourse-cdn.com/v4/letter/v/bcef8e/32.png) [@vijuitech](https://discuss.elastic.co/u/vijuitech)\
**Post date:** [March 15, 2012, 5:02am UTC](https://discuss.elastic.co/t/getting-the-facets-for-the-entire-response/6996/3 "2012-03-15T05:02:00Z")

</div>

Thanks...I used the code by removing the size and it is taking  
default as 10 facets..Here is my code

searchRequestBuilder.addFacet(FacetBuilders.termsFacet("namecount").field("  
name.namesort"));  
response = searchRequestBuilder.execute().actionGet();

How can I get all facets of the whole response?

Cheers!!

George

On Mar 14, 7:15 pm, "[da...@pilato.fr](mailto:da...@pilato.fr)" [da...@pilato.fr](mailto:da...@pilato.fr) wrote:

> By default, facets are computed on the whole response.
> 
> I suggest to remove the .size(10).
> 
> HTH
> 
> Le 14 mars 2012 à 14:03, George Viju [vijuit...@gmail.com](mailto:vijuit...@gmail.com) a écrit :
> 
> > Hi all,  
> > How can I get the facets of the whole response?
> 
> > For Example
> 
> searchRequestBuilder.addFacet(FacetBuilders.termsFacet("namecount").field(" name.namesort").size(10));
> 
> > response = searchRequestBuilder.execute().actionGet();
> 
> > Here am getting the facets for the first 10 data in the response. How  
> > can I get the facets for the all data in the whole response.
> 
> > Cheers!!
> 
> > George
> 
> --  
> David Pilatohttp://dev.david.pilato.fr/  
> Twitter : @dadoonet

---

<div class="post-metadata">

**Author:** ![dadoonet](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/dadoonet/32/137187_2.png) [@dadoonet](https://discuss.elastic.co/u/dadoonet)\
**Post date:** [March 15, 2012, 5:35am UTC](https://discuss.elastic.co/t/getting-the-facets-for-the-entire-response/6996/4 "2012-03-15T05:35:31Z")

</div>

Ok. I didn't understand the first post.  
I think you are looking for this :

> <https://github.com/elastic/elasticsearch/issues/1776>
>
> Is it possible to add support for setting "size": 0 to simple Term Facets in ord…er to return all terms matching the hits?
> 
> This should be similar to the TermsStats Facet api.

David 😉  
@dadoonet

Le 15 mars 2012 à 06:02, George Viju [vijuitech@gmail.com](mailto:vijuitech@gmail.com) a écrit :

> Thanks...I used the code by removing the size and it is taking  
> default as 10 facets..Here is my code
> 
> searchRequestBuilder.addFacet(FacetBuilders.termsFacet("namecount").field("  
> name.namesort"));  
> response = searchRequestBuilder.execute().actionGet();
> 
> How can I get all facets of the whole response?
> 
> Cheers!!
> 
> George
> 
> On Mar 14, 7:15 pm, "[da...@pilato.fr](mailto:da...@pilato.fr)" [da...@pilato.fr](mailto:da...@pilato.fr) wrote:
> 
> > By default, facets are computed on the whole response.
> > 
> > I suggest to remove the .size(10).
> > 
> > HTH
> > 
> > Le 14 mars 2012 à 14:03, George Viju [vijuit...@gmail.com](mailto:vijuit...@gmail.com) a écrit :
> > 
> > > Hi all,  
> > > How can I get the facets of the whole response?
> > 
> > > For Example
> > 
> > searchRequestBuilder.addFacet(FacetBuilders.termsFacet("namecount").field(" name.namesort").size(10));
> > 
> > > response = searchRequestBuilder.execute().actionGet();
> > 
> > > Here am getting the facets for the first 10 data in the response. How  
> > > can I get the facets for the all data in the whole response.
> > 
> > > Cheers!!
> > 
> > > George
> > 
> > --  
> > David Pilatohttp://dev.david.pilato.fr/  
> > Twitter : @dadoonet

---

<div class="post-metadata">

**Author:** ![vijuitech](https://avatars.discourse-cdn.com/v4/letter/v/bcef8e/32.png) [@vijuitech](https://discuss.elastic.co/u/vijuitech)\
**Post date:** [March 15, 2012, 6:23am UTC](https://discuss.elastic.co/t/getting-the-facets-for-the-entire-response/6996/5 "2012-03-15T06:23:32Z")

</div>

Thanks so much David!

Cheers

George

On Mar 15, 10:35 am, David Pilato [da...@pilato.fr](mailto:da...@pilato.fr) wrote:

> Ok. I didn't understand the first post.  
> I think you are looking for this :[Support "size": 0 for Term Facet · Issue #1776 · elastic/elasticsearch · GitHub](https://github.com/elasticsearch/elasticsearch/issues/1776)
> 
> David 😉  
> @dadoonet
> 
> Le 15 mars 2012 à 06:02, George Viju [vijuit...@gmail.com](mailto:vijuit...@gmail.com) a écrit :
> 
> > Thanks...I used the code by removing the size and it is taking  
> > default as 10facets..Here is my code
> 
> > searchRequestBuilder.addFacet(FacetBuilders.termsFacet("namecount").field("  
> > name.namesort"));  
> > response= searchRequestBuilder.execute().actionGet();
> 
> > How can I get allfacetsof the wholeresponse?
> 
> > Cheers!!
> 
> > George
> 
> > On Mar 14, 7:15 pm, "[da...@pilato.fr](mailto:da...@pilato.fr)" [da...@pilato.fr](mailto:da...@pilato.fr) wrote:
> > 
> > > By default,facetsare computed on the wholeresponse.
> 
> > > I suggest to remove the .size(10).
> 
> > > HTH
> 
> > > Le 14 mars 2012 à 14:03, George Viju [vijuit...@gmail.com](mailto:vijuit...@gmail.com) a écrit :
> 
> > > > Hi all,  
> > > > How can I get thefacetsof the wholeresponse?
> 
> > > > For Example
> 
> > > searchRequestBuilder.addFacet(FacetBuilders.termsFacet("namecount").field(" name.namesort").size(10));
> 
> > > > response= searchRequestBuilder.execute().actionGet();
> 
> > > > Here amgettingthefacetsfor the first 10 data in theresponse. How  
> > > > can I get thefacetsfor the all data in the wholeresponse.
> 
> > > > Cheers!!
> 
> > > > George
> 
> > > --  
> > > David Pilatohttp://dev.david.pilato.fr/  
> > > Twitter : @dadoonet

---

<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:36am UTC](https://discuss.elastic.co/t/getting-the-facets-for-the-entire-response/6996/6 "2017-07-06T03:36:03Z")

</div>


