# \*same\* query return different result

**URL:** <https://discuss.elastic.co/t/same-query-return-different-result/17035>\
**Category:** Elasticsearch\
**Created:** [April 15, 2014, 10:09pm UTC](https://discuss.elastic.co/t/same-query-return-different-result/17035 "2014-04-15T22:09:13Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![Chen\_Wang](https://avatars.discourse-cdn.com/v4/letter/c/b5a626/32.png) [@Chen\_Wang](https://discuss.elastic.co/u/Chen_Wang)\
**Post date:** [April 15, 2014, 10:09pm UTC](https://discuss.elastic.co/t/same-query-return-different-result/17035/1 "2014-04-15T22:09:13Z")

</div>

I am using version 1.0.0.RC2

for the following two queries: one is using match\_all, the other is using  
term filter  
"query": {  
"match\_all": {}  
},  
"aggregations": {  
"by\_campaign": {  
"terms": {  
"field": "campaign\_name"  
}  
}  
}

* * *

"query": {  
"term": {"campaign\_name.original":"snbp\_407400"}  
},  
"aggregations": {  
"by\_campaign": {  
"terms": {  
"field": "campaign\_name.original"  
}  
}  
}

However the result is different:  
with match\_all, it returns 3 records  
{  
"key": "snbp\_407600",  
"doc\_count": 3  
},

with term query it returns 4 records  
{  
"key": "snbp\_407400",  
"doc\_count": 4  
}

and there are a total of 4 records.(meaning the one with term query is  
correct). Any idea why this is happending?  
Thanks,  
Chen

--  
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/CACim9Rm5zCPEzYyVxfuqwmJGkLSHHApqmXbkqyLrpOhUKURqCg%40mail.gmail.com](https://groups.google.com/d/msgid/elasticsearch/CACim9Rm5zCPEzYyVxfuqwmJGkLSHHApqmXbkqyLrpOhUKURqCg%40mail.gmail.com).  
For more options, visit [https://groups.google.com/d/optout](https://groups.google.com/d/optout).

---

<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:35am UTC](https://discuss.elastic.co/t/same-query-return-different-result/17035/2 "2017-07-06T01:35:37Z")

</div>


