# Statistical Facets for distinct Results to avoid double counting

**URL:** <https://discuss.elastic.co/t/statistical-facets-for-distinct-results-to-avoid-double-counting/14436>\
**Category:** Elasticsearch\
**Created:** [November 16, 2013, 8:25pm UTC](https://discuss.elastic.co/t/statistical-facets-for-distinct-results-to-avoid-double-counting/14436 "2013-11-16T20:25:34Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![VB1](https://avatars.discourse-cdn.com/v4/letter/v/2acd7d/32.png) [@VB1](https://discuss.elastic.co/u/VB1)\
**Post date:** [November 16, 2013, 8:25pm UTC](https://discuss.elastic.co/t/statistical-facets-for-distinct-results-to-avoid-double-counting/14436/1 "2013-11-16T20:25:34Z")

</div>

We have use case where we have query which can bring duplicate results and  
we are running Statistical Facets on them.

This results gives wrong results as query results in duplicate documents.  
Is there any way we can avoid duplicate counting?

Any help will be highly appreciated.

Here is the example query  
{  
"query": {  
"bool": {  
"must": [  
{  
"bool": {  
"must": [  
{  
"range": {  
"Latitude": {  
"from": "0",  
"to": "19150"  
}  
}  
},  
{  
"range": {  
"Longitude": {  
"from": "0",  
"to": "19150"  
}  
}  
}  
]  
}  
},  
{  
"has\_parent": {  
"parent\_type": "contractsearch",  
"query": {  
"bool": {  
"must": [  
{  
"range": {  
"Id": {  
"gt": "0"  
}  
}  
},  
{  
"has\_child": {  
"type": "exposuregraphsearch",  
"query": {  
"terms": {  
"CedantExposureIdList": [  
"706341"  
]  
}  
}  
}  
}  
]  
}  
}  
}  
}  
]  
}  
},  
"facets": {  
"Latitude": {  
"statistical": {  
"fields": [  
"Latitude"  
]  
}  
},  
"Longitude": {  
"statistical": {  
"fields": [  
"Longitude"  
]  
}  
}  
}  
}

--  
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:06am UTC](https://discuss.elastic.co/t/statistical-facets-for-distinct-results-to-avoid-double-counting/14436/2 "2017-07-06T02:06:36Z")

</div>

Closed on July 6, 2017, 2:06am UTC


