# Facet\_filter with multiple keys and multiple values

**URL:** <https://discuss.elastic.co/t/facet-filter-with-multiple-keys-and-multiple-values/12647>\
**Category:** Elasticsearch\
**Created:** [July 3, 2013, 3:10pm UTC](https://discuss.elastic.co/t/facet-filter-with-multiple-keys-and-multiple-values/12647 "2013-07-03T15:10:01Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![jeremie\_bordier](https://avatars.discourse-cdn.com/v4/letter/j/919ad9/32.png) [@jeremie\_bordier](https://discuss.elastic.co/u/jeremie_bordier)\
**Post date:** [July 3, 2013, 3:10pm UTC](https://discuss.elastic.co/t/facet-filter-with-multiple-keys-and-multiple-values/12647/1 "2013-07-03T15:10:01Z")

</div>

Hello Elasticers,

I'm trying to figure out a way to perform a facet\_filter with the following  
semantic:

product\_type:(tshirts OR jean) AND color:(red OR blue)

The problem is that it seems that the default behavior is just a big OR  
between terms (product\_type:tshirts OR product\_type:jean OR color:red OR  
color:blue).

Here's my current request json:

"facets": {  
"tags": {  
"terms": {  
"field": "tags",  
"size": 10,  
"all\_terms": false  
},  
"facet\_filter": {  
"terms": {  
"product\_type": [  
"tshirts", "jean"  
],  
"color": [  
"red", "blue"  
]  
}  
}  
}  
}

Thanks by advance !

Cheers,  
Jérémie

--  
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:** ![Ivan](https://avatars.discourse-cdn.com/v4/letter/i/df788c/32.png) [@Ivan](https://discuss.elastic.co/u/Ivan)\
**Post date:** [July 3, 2013, 8:40pm UTC](https://discuss.elastic.co/t/facet-filter-with-multiple-keys-and-multiple-values/12647/2 "2013-07-03T20:40:30Z")

</div>

You can use a bool filter as the facet filter and have explicit AND/OR  
(actually must/should) clauses.

--  
Ivan

On Wed, Jul 3, 2013 at 8:10 AM, Jérémie BORDIER [ahfeel@gmail.com](mailto:ahfeel@gmail.com) wrote:

> Hello Elasticers,
> 
> I'm trying to figure out a way to perform a facet\_filter with the  
> following semantic:
> 
> product\_type:(tshirts OR jean) AND color:(red OR blue)
> 
> The problem is that it seems that the default behavior is just a big OR  
> between terms (product\_type:tshirts OR product\_type:jean OR color:red OR  
> color:blue).
> 
> Here's my current request json:
> 
> "facets": {  
> "tags": {  
> "terms": {  
> "field": "tags",  
> "size": 10,  
> "all\_terms": false  
> },  
> "facet\_filter": {  
> "terms": {  
> "product\_type": [  
> "tshirts", "jean"  
> ],  
> "color": [  
> "red", "blue"  
> ]  
> }  
> }  
> }  
> }
> 
> Thanks by advance !
> 
> Cheers,  
> Jérémie
> 
> --  
> 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:** ![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:28am UTC](https://discuss.elastic.co/t/facet-filter-with-multiple-keys-and-multiple-values/12647/3 "2017-07-06T02:28:17Z")

</div>


