# Min\_document\_doc in nested aggregations

**URL:** <https://discuss.elastic.co/t/min-document-doc-in-nested-aggregations/20872>\
**Category:** Elasticsearch\
**Created:** [November 20, 2014, 6:29pm UTC](https://discuss.elastic.co/t/min-document-doc-in-nested-aggregations/20872 "2014-11-20T18:29:29Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![kazoompa\_3](https://avatars.discourse-cdn.com/v4/letter/k/958977/32.png) [@kazoompa\_3](https://discuss.elastic.co/u/kazoompa_3)\
**Post date:** [November 20, 2014, 6:29pm UTC](https://discuss.elastic.co/t/min-document-doc-in-nested-aggregations/20872/1 "2014-11-20T18:29:29Z")

</div>

Hi,

I have several aggregations each of which have their own inner  
aggregations. It seems that the 'min\_document\_doc' does not apply when  
their containing aggregation is itself empty. I presumed that because both  
level of aggregations use 'min\_document\_doc' there would be buckets for the  
inner agg as well.

Can somebody enlighten me on why ES cannot do this, sort of a technical  
insight would be appreciated.

Thanks.

Here is a snippet of my query:  
...  
"aggregations": {  
"totalCount": {  
"global": {}  
},  
"categories-missing": {  
"terms": {  
"field": "categories.missing",  
"size": 0,  
"min\_doc\_count": 0,  
"order": {  
"\_term": "asc"  
}  
}  
},  
"datasetId": {  
"terms": {  
"field": "datasetId",  
"size": 0,  
"min\_doc\_count": 0,  
"order": {  
"\_term": "asc"  
}  
},  
"aggregations": {  
"attributes-Default": {  
"terms": {  
"field": "attributes.Default",  
"size": 0,  
"min\_doc\_count": 0,  
"order": {  
"\_term": "asc"  
}  
}  
},  
"attributes-Administrative\_information": {  
"terms": {  
"field": "attributes.Administrative\_information",  
"size": 0,  
"min\_doc\_count": 0,  
"order": {  
"\_term": "asc"  
}  
}  
},  
...

--  
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/d00b5831-351e-4f36-9197-9d56928667eb%40googlegroups.com](https://groups.google.com/d/msgid/elasticsearch/d00b5831-351e-4f36-9197-9d56928667eb%40googlegroups.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, 12:48am UTC](https://discuss.elastic.co/t/min-document-doc-in-nested-aggregations/20872/2 "2017-07-06T00:48:36Z")

</div>


