# Elasticsearch: Include facet values?

**URL:** <https://discuss.elastic.co/t/elasticsearch-include-facet-values/11591>\
**Category:** Elasticsearch\
**Created:** [April 15, 2013, 5:31pm UTC](https://discuss.elastic.co/t/elasticsearch-include-facet-values/11591 "2013-04-15T17:31:02Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![Samuel\_Molnar](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/samuel_molnar/32/2253_2.png) [@Samuel\_Molnar](https://discuss.elastic.co/u/Samuel_Molnar)\
**Post date:** [April 15, 2013, 5:31pm UTC](https://discuss.elastic.co/t/elasticsearch-include-facet-values/11591/1 "2013-04-15T17:31:02Z")

</div>

Elasticsearch provides parameter to exclude certain facets from facets  
values like this.

"facets" : {  
"tag" : {  
"terms" : {  
"field" : "tag",  
"exclude" : ["term1", "term2"]  
}  
}  
}

Is it possible not to exclude, but include certain facet values?

Thanks

--  
You received this message because you are subscribed to the Google Groups "elasticsearch" group.  
To unsubscribe from this group and stop receiving emails from it, send an email to [elasticsearch+unsubscribe@googlegroups.com](mailto:elasticsearch+unsubscribe@googlegroups.com).  
For more options, visit [https://groups.google.com/groups/opt\_out](https://groups.google.com/groups/opt_out).

---

<div class="post-metadata">

**Author:** ![spinscale](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/spinscale/32/25011_2.png) [@spinscale](https://discuss.elastic.co/u/spinscale)\
**Post date:** [April 15, 2013, 5:57pm UTC](https://discuss.elastic.co/t/elasticsearch-include-facet-values/11591/2 "2013-04-15T17:57:27Z")

</div>

Hey,

you could do that using a regex instead of excludes. See

> **[Elasticsearch Platform — Find real-time answers at scale](https://www.elastic.co)**
>
> Power insights and outcomes with the Elasticsearch Platform and AI. See into your data and find answers that matter with enterprise solutions designed to help you build, observe, and protect. Try Elasticsearch free today.

On Mon, Apr 15, 2013 at 7:31 PM, Samuel Molnar [molnar.samuel@gmail.com](mailto:molnar.samuel@gmail.com)wrote:

> Elasticsearch provides parameter to exclude certain facets from facets  
> values like this.
> 
> "facets" : {  
> "tag" : {  
> "terms" : {  
> "field" : "tag",  
> "exclude" : ["term1", "term2"]  
> }  
> }  
> }
> 
> Is it possible not to exclude, but include certain facet values?
> 
> Thanks
> 
> --  
> You received this message because you are subscribed to the Google Groups  
> "elasticsearch" group.  
> To unsubscribe from this group and stop receiving emails from it, send an  
> email to [elasticsearch+unsubscribe@googlegroups.com](mailto:elasticsearch+unsubscribe@googlegroups.com).  
> For more options, visit [https://groups.google.com/groups/opt\_out](https://groups.google.com/groups/opt_out).

--  
You received this message because you are subscribed to the Google Groups "elasticsearch" group.  
To unsubscribe from this group and stop receiving emails from it, send an email to [elasticsearch+unsubscribe@googlegroups.com](mailto:elasticsearch+unsubscribe@googlegroups.com).  
For more options, visit [https://groups.google.com/groups/opt\_out](https://groups.google.com/groups/opt_out).

---

<div class="post-metadata">

**Author:** ![Samuel\_Molnar](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/samuel_molnar/32/2253_2.png) [@Samuel\_Molnar](https://discuss.elastic.co/u/Samuel_Molnar)\
**Post date:** [April 15, 2013, 6:19pm UTC](https://discuss.elastic.co/t/elasticsearch-include-facet-values/11591/3 "2013-04-15T18:19:14Z")

</div>

yes, but i need to get facets for the documents and also include other  
specific (selected, if you will) values that are in the list of facets but  
have low count, so they wont be in result list.

Consider following situation: You want global facets of words for documents  
and you selected e.g. word _science_ with count 10. But if you recieve  
global facets, you get words with counts higher than e.g. 4000. I need to  
get the global facets along with selected ones.

Is there any way how i can do that?

Dňa pondelok, 15. apríla 2013 19:57:27 UTC+2 Alexander Reelsen napísal(-a):

> Hey,
> 
> you could do that using a regex instead of excludes. See  
> [Elasticsearch Platform — Find real-time answers at scale | Elastic](http://www.elasticsearch.org/guide/reference/api/search/facets/terms-facet/)
> 
> On Mon, Apr 15, 2013 at 7:31 PM, Samuel Molnar \<[molnar...@gmail.com](mailto:molnar...@gmail.com)\<javascript:\>
> 
> > wrote:
> 
> > Elasticsearch provides parameter to exclude certain facets from facets  
> > values like this.
> > 
> > "facets" : {  
> > "tag" : {  
> > "terms" : {  
> > "field" : "tag",  
> > "exclude" : ["term1", "term2"]  
> > }  
> > }  
> > }
> > 
> > Is it possible not to exclude, but include certain facet values?
> > 
> > Thanks
> > 
> > --  
> > You received this message because you are subscribed to the Google Groups  
> > "elasticsearch" group.  
> > To unsubscribe from this group and stop receiving emails from it, send an  
> > email to [elasticsearc...@googlegroups.com](mailto:elasticsearc...@googlegroups.com) \<javascript:\>.  
> > For more options, visit [https://groups.google.com/groups/opt\_out](https://groups.google.com/groups/opt_out).

--  
You received this message because you are subscribed to the Google Groups "elasticsearch" group.  
To unsubscribe from this group and stop receiving emails from it, send an email to [elasticsearch+unsubscribe@googlegroups.com](mailto:elasticsearch+unsubscribe@googlegroups.com).  
For more options, visit [https://groups.google.com/groups/opt\_out](https://groups.google.com/groups/opt_out).

---

<div class="post-metadata">

**Author:** ![roytmana](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/roytmana/32/44855_2.png) [@roytmana](https://discuss.elastic.co/u/roytmana)\
**Post date:** [April 15, 2013, 8:49pm UTC](https://discuss.elastic.co/t/elasticsearch-include-facet-values/11591/4 "2013-04-15T20:49:02Z")

</div>

I would also love to have such functionality. I think you can work around  
it by having two facets on the the same field - one with filter to include  
desired values and the other without. Then you can combine their results  
using any logic/ordering you want

Alex

On Monday, April 15, 2013 2:19:14 PM UTC-4, Samuel Molnar wrote:

> yes, but i need to get facets for the documents and also include other  
> specific (selected, if you will) values that are in the list of facets but  
> have low count, so they wont be in result list.
> 
> Consider following situation: You want global facets of words for  
> documents and you selected e.g. word _science_ with count 10. But if you  
> recieve global facets, you get words with counts higher than e.g. 4000. I  
> need to get the global facets along with selected ones.
> 
> Is there any way how i can do that?
> 
> Dňa pondelok, 15. apríla 2013 19:57:27 UTC+2 Alexander Reelsen napísal(-a):
> 
> > Hey,
> > 
> > you could do that using a regex instead of excludes. See  
> > [Elasticsearch Platform — Find real-time answers at scale | Elastic](http://www.elasticsearch.org/guide/reference/api/search/facets/terms-facet/)
> > 
> > On Mon, Apr 15, 2013 at 7:31 PM, Samuel Molnar [molnar...@gmail.com](mailto:molnar...@gmail.com)wrote:
> > 
> > > Elasticsearch provides parameter to exclude certain facets from facets  
> > > values like this.
> > > 
> > > "facets" : {  
> > > "tag" : {  
> > > "terms" : {  
> > > "field" : "tag",  
> > > "exclude" : ["term1", "term2"]  
> > > }  
> > > }  
> > > }
> > > 
> > > Is it possible not to exclude, but include certain facet values?
> > > 
> > > Thanks
> > > 
> > > --  
> > > You received this message because you are subscribed to the Google  
> > > Groups "elasticsearch" group.  
> > > To unsubscribe from this group and stop receiving emails from it, send  
> > > an email to [elasticsearc...@googlegroups.com](mailto:elasticsearc...@googlegroups.com).  
> > > For more options, visit [https://groups.google.com/groups/opt\_out](https://groups.google.com/groups/opt_out).

--  
You received this message because you are subscribed to the Google Groups "elasticsearch" group.  
To unsubscribe from this group and stop receiving emails from it, send an email to [elasticsearch+unsubscribe@googlegroups.com](mailto:elasticsearch+unsubscribe@googlegroups.com).  
For more options, visit [https://groups.google.com/groups/opt\_out](https://groups.google.com/groups/opt_out).

---

<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, 2:40am UTC](https://discuss.elastic.co/t/elasticsearch-include-facet-values/11591/5 "2017-07-06T02:40:59Z")

</div>


