# How to improve accuracy of aggregation doc\_count

**URL:** https://discuss.elastic.co/t/how-to-improve-accuracy-of-aggregation-doc-count/148876
**Category:** Elasticsearch
**Created:** [September 17, 2018, 7:05pm UTC](https://discuss.elastic.co/t/how-to-improve-accuracy-of-aggregation-doc-count/148876 "2018-09-17T19:05:19Z")
**Posts on this page:** 2
**Page:** 1

<div class="post-metadata">

### Author: ![premier](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/premier/32/14938_2.png) [@premier](https://discuss.elastic.co/u/premier)
#### Post date: [September 17, 2018, 7:05pm UTC](https://discuss.elastic.co/t/how-to-improve-accuracy-of-aggregation-doc-count/148876/1 "2018-09-17T19:05:19Z")

</div>

Elasticsearch documentation states that doc\_counts are approximate and we are seeing count discrepancies in our aggregations. This is a big issue for our customers How can we improve the accuracy of the doc\_count in nested documents?

Elasticsearch v6.1.1

Following is my search query:  
{  
"from": 0,  
"size": 10,  
"query": {  
"bool": {  
"must": [  
{  
"query\_string": {  
"query": "\*"  
}  
},  
{  
"siteGuid.keyword": "d4908c7d-fc14-4aaf-b85d-8dc1bafd7cfd"  
}  
}  
]  
}  
},  
"aggs": {  
"--CUSTOM--": {  
"nested": {  
"path": "binning.binningSets"  
},  
"aggs": {  
"--Binning--": {  
"terms": {  
"field": "binning.binningSets.label",  
"size": 100,  
"order": { "\_key" : "asc"}  
},  
"aggs": {  
"--Bin Set--": {  
"nested": {  
"path": "binning.binningSets.bins"  
},  
"aggs": {  
"--Bins--": {  
"terms": {  
"field": "binning.binningSets.bins.token",  
"size":100,  
"order": { "\_key" : "asc"}  
}  
}  
}  
}  
}  
}  
}  
}  
}  
}

Thank you!

---

<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: [October 15, 2018, 7:05pm UTC](https://discuss.elastic.co/t/how-to-improve-accuracy-of-aggregation-doc-count/148876/2 "2018-10-15T19:05:23Z")

</div>

This topic was automatically closed 28 days after the last reply. New replies are no longer allowed.
