# TermsFacet across index returns wrong results

**URL:** https://discuss.elastic.co/t/termsfacet-across-index-returns-wrong-results/11192
**Category:** Elasticsearch
**Created:** [March 18, 2013, 3:45pm UTC](https://discuss.elastic.co/t/termsfacet-across-index-returns-wrong-results/11192 "2013-03-18T15:45:44Z")
**Posts on this page:** 2
**Page:** 1

<div class="post-metadata">

### Author: ![Itamar\_Syn\_Hershko](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/itamar_syn_hershko/32/725_2.png) [@Itamar\_Syn\_Hershko](https://discuss.elastic.co/u/Itamar_Syn_Hershko)
#### Post date: [March 18, 2013, 3:45pm UTC](https://discuss.elastic.co/t/termsfacet-across-index-returns-wrong-results/11192/1 "2013-03-18T15:45:44Z")

</div>

Hi,

When faceting on more than one index, each with one shard, no replicas, and  
containing the same data structure, TermsFacet will return the wrong  
counts. This can be easily verified by running a simple query with the  
facet value. Additionally, changing the size parameter will cause facet  
results to change (while we only expected to get a shorter/longer list , we  
actually see values change and terms disappear).  
\*  
\*  
Our faceting query:  
\*  
\*  
{  
"from" : 0,  
"size" : 0,  
"query" : {  
"filtered" : {  
"query" : {  
"query\_string" : {  
"query" : "test",  
"fields" : ["title", "topic"]  
}  
},  
"filter" : {  
"numeric\_range" : {  
"topic\_date" : {  
"from" : "2012-12-17T00:00:00.000+02:00",  
"to" : "2013-03-17T23:59:59.999+02:00",  
"include\_lower" : true,  
"include\_upper" : true  
}  
}  
}  
}  
},  
"facets" : {  
"termFacet" : {  
"terms" : {  
"fields" : ["author"],  
"size" : 10  
},  
"facet\_filter" : {  
"numeric\_range" : {  
"topic\_date" : {  
"from" : "2012-12-17T00:00:00.000+02:00",  
"to" : "2013-03-17T23:59:59.999+02:00",  
"include\_lower" : true,  
"include\_upper" : true  
}  
}  
}  
}  
}  
}

I also opened a bug for this on github:

> <https://github.com/elastic/elasticsearch/issues/2797>

Itamar.

--  
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:46am UTC](https://discuss.elastic.co/t/termsfacet-across-index-returns-wrong-results/11192/2 "2017-07-06T02:46:05Z")

</div>


