# Couple questions on facets, filters and queries

**URL:** https://discuss.elastic.co/t/couple-questions-on-facets-filters-and-queries/15926
**Category:** Elasticsearch
**Created:** [February 20, 2014, 2:39pm UTC](https://discuss.elastic.co/t/couple-questions-on-facets-filters-and-queries/15926 "2014-02-20T14:39:19Z")
**Posts on this page:** 6
**Page:** 1

<div class="post-metadata">

### Author: ![project2501](https://avatars.discourse-cdn.com/v4/letter/p/41988e/32.png) [@project2501](https://discuss.elastic.co/u/project2501)
#### Post date: [February 20, 2014, 2:39pm UTC](https://discuss.elastic.co/t/couple-questions-on-facets-filters-and-queries/15926/1 "2014-02-20T14:39:19Z")

</div>

1. Do facet filters produce (or are supposed to produce) the same facet  
counts as query strings with facets? Doesn't seem to
2. Do DSL query facets produce same counts as query string queries with  
facets? Don't seem to
3. Do queries with filters produce same facet counts as any of the above?  
Don't seem to
4. Does highlighting work with any of the above? I only got it to work when  
I use query string queries....
5. Search result counts and query counts for the same expressions (nested  
fields) do not produce the same counts.  
When will this be fixed?

Thanks for any answers. These are important features that produce different  
results for me.

--  
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).  
To view this discussion on the web visit [https://groups.google.com/d/msgid/elasticsearch/b29825ac-0c1e-41da-825d-d0118cb78443%40googlegroups.com](https://groups.google.com/d/msgid/elasticsearch/b29825ac-0c1e-41da-825d-d0118cb78443%40googlegroups.com).  
For more options, visit [https://groups.google.com/groups/opt\_out](https://groups.google.com/groups/opt_out).

---

<div class="post-metadata">

### Author: ![Binh\_Ly](https://avatars.discourse-cdn.com/v4/letter/b/ce7236/32.png) [@Binh\_Ly](https://discuss.elastic.co/u/Binh_Ly)
#### Post date: [February 20, 2014, 4:00pm UTC](https://discuss.elastic.co/t/couple-questions-on-facets-filters-and-queries/15926/2 "2014-02-20T16:00:06Z")

</div>

The best way to help you is if you can show a complete example of your data  
and queries (doesn't have to be much or complex) and then we can take a  
look analyze your queries one by one.

--  
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).  
To view this discussion on the web visit [https://groups.google.com/d/msgid/elasticsearch/ad598dcd-7d80-41b3-8252-e4353fb0cb9e%40googlegroups.com](https://groups.google.com/d/msgid/elasticsearch/ad598dcd-7d80-41b3-8252-e4353fb0cb9e%40googlegroups.com).  
For more options, visit [https://groups.google.com/groups/opt\_out](https://groups.google.com/groups/opt_out).

---

<div class="post-metadata">

### Author: ![project2501](https://avatars.discourse-cdn.com/v4/letter/p/41988e/32.png) [@project2501](https://discuss.elastic.co/u/project2501)
#### Post date: [February 21, 2014, 12:34am UTC](https://discuss.elastic.co/t/couple-questions-on-facets-filters-and-queries/15926/3 "2014-02-21T00:34:56Z")

</div>

I was just asking in case there are known issues with those items or if  
they are not supposed to work that way.

I'm not sure if there is a problem if elasticsearch handles facet counts  
differently for filters, queries, etc.

For example, is ES supposed to return same facet counts with facet filters  
as you would with query + facets (no filters), etc.  
In other words, how does elasticsearch view those combinations for itself?

Then I will know if there is a problem I am having.

On Thursday, February 20, 2014 11:00:06 AM UTC-5, Binh Ly wrote:

> The best way to help you is if you can show a complete example of your  
> data and queries (doesn't have to be much or complex) and then we can take  
> a look analyze your queries one by one.

--  
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).  
To view this discussion on the web visit [https://groups.google.com/d/msgid/elasticsearch/05542b62-3e6b-46d9-a3c9-bcc111ecaec9%40googlegroups.com](https://groups.google.com/d/msgid/elasticsearch/05542b62-3e6b-46d9-a3c9-bcc111ecaec9%40googlegroups.com).  
For more options, visit [https://groups.google.com/groups/opt\_out](https://groups.google.com/groups/opt_out).

---

<div class="post-metadata">

### Author: ![Binh\_Ly](https://avatars.discourse-cdn.com/v4/letter/b/ce7236/32.png) [@Binh\_Ly](https://discuss.elastic.co/u/Binh_Ly)
#### Post date: [February 21, 2014, 12:59pm UTC](https://discuss.elastic.co/t/couple-questions-on-facets-filters-and-queries/15926/4 "2014-02-21T12:59:54Z")

</div>

If your question is:

1. {  
"query": {  
Q  
}  
"facets": {  
F  
}  
}

2. {  
"query": {  
"match\_all": {}  
}  
"facets": {  
"F": {  
...  
"facet\_filter":  
{  
Q  
}  
}  
}

Will 1) and 2) give the same results for facet F, the answer is yes. Best  
way really is to experiment with data and queries.

On Thursday, February 20, 2014 7:34:56 PM UTC-5, project2501 wrote:

> For example, is ES supposed to return same facet counts with facet filters  
> as you would with query + facets (no filters), etc.  
> In other words, how does elasticsearch view those combinations for itself?

--  
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).  
To view this discussion on the web visit [https://groups.google.com/d/msgid/elasticsearch/aadaf5c4-6502-4948-8b22-ce88960c9c5c%40googlegroups.com](https://groups.google.com/d/msgid/elasticsearch/aadaf5c4-6502-4948-8b22-ce88960c9c5c%40googlegroups.com).  
For more options, visit [https://groups.google.com/groups/opt\_out](https://groups.google.com/groups/opt_out).

---

<div class="post-metadata">

### Author: ![project2501](https://avatars.discourse-cdn.com/v4/letter/p/41988e/32.png) [@project2501](https://discuss.elastic.co/u/project2501)
#### Post date: [February 21, 2014, 2:37pm UTC](https://discuss.elastic.co/t/couple-questions-on-facets-filters-and-queries/15926/5 "2014-02-21T14:37:18Z")

</div>

But there are performance implications between the two.

Also, I notice that the highlighter does not work the same between 1 and 2.  
Should it?

Then I can know if I am having a problem or if there are known issues with  
this.

I appreciate your help. Thank you!

On Friday, February 21, 2014 7:59:54 AM UTC-5, Binh Ly wrote:

> If your question is:
> 
> 1. {  
> "query": {  
> Q  
> }  
> "facets": {  
> F  
> }  
> }
> 
> 2. {  
> "query": {  
> "match\_all": {}  
> }  
> "facets": {  
> "F": {  
> ...  
> "facet\_filter":  
> {  
> Q  
> }  
> }  
> }
> 
> Will 1) and 2) give the same results for facet F, the answer is yes. Best  
> way really is to experiment with data and queries.
> 
> On Thursday, February 20, 2014 7:34:56 PM UTC-5, project2501 wrote:
> 
> > For example, is ES supposed to return same facet counts with facet  
> > filters as you would with query + facets (no filters), etc.  
> > In other words, how does elasticsearch view those combinations for itself?

--  
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).  
To view this discussion on the web visit [https://groups.google.com/d/msgid/elasticsearch/f4bac768-cc89-441e-9905-7bdcf02f0f00%40googlegroups.com](https://groups.google.com/d/msgid/elasticsearch/f4bac768-cc89-441e-9905-7bdcf02f0f00%40googlegroups.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, 1:48am UTC](https://discuss.elastic.co/t/couple-questions-on-facets-filters-and-queries/15926/6 "2017-07-06T01:48:18Z")

</div>


