# Get Document aggregation same as windows

**URL:** https://discuss.elastic.co/t/get-document-aggregation-same-as-windows/114504
**Category:** Elasticsearch
**Created:** [January 8, 2018, 11:10am UTC](https://discuss.elastic.co/t/get-document-aggregation-same-as-windows/114504 "2018-01-08T11:10:53Z")
**Posts on this page:** 3
**Page:** 1

<div class="post-metadata">

### Author: ![krishnaraj221193](https://avatars.discourse-cdn.com/v4/letter/k/85e7bf/32.png) [@krishnaraj221193](https://discuss.elastic.co/u/krishnaraj221193)
#### Post date: [January 8, 2018, 11:10am UTC](https://discuss.elastic.co/t/get-document-aggregation-same-as-windows/114504/1 "2018-01-08T11:10:53Z")

</div>

Hi sir I can see in windows if i go and select a folder and see the properties i can see total files (inside the folder + files inside subfolders + files till nth level) how can this be achived through elasticsearch

---

<div class="post-metadata">

### Author: ![luiz.santos](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/luiz.santos/32/24664_2.png) [@luiz.santos](https://discuss.elastic.co/u/luiz.santos)
#### Post date: [January 9, 2018, 12:27pm UTC](https://discuss.elastic.co/t/get-document-aggregation-same-as-windows/114504/2 "2018-01-09T12:27:52Z")

</div>

Hi @krishnaraj221193,

Every [bucket aggregation](https://www.elastic.co/guide/en/elasticsearch/reference/current/search-aggregations-bucket.html) in elasticsearch returns the doc count associated with it.

For example, the [terms aggregation](https://www.elastic.co/guide/en/elasticsearch/reference/current/search-aggregations-bucket-terms-aggregation.html) will retrieve the top values ordered by doc count:

```
GET /_search
{
    "aggs" : {
        "genres" : {
            "terms" : { "field" : "genre" }
        }
    }
}

{
    ...
    "aggregations" : {
        "genres" : {
            "doc_count_error_upper_bound": 0, 
            "sum_other_doc_count": 0, 
            "buckets" : [ 
                {
                    "key" : "electronic",
                    "doc_count" : 6
                },
                {
                    "key" : "rock",
                    "doc_count" : 3
                },
                {
                    "key" : "jazz",
                    "doc_count" : 2
                }
            ]
        }
    }
}

```

Cheers,  
LG

---

<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: [February 6, 2018, 12:28pm UTC](https://discuss.elastic.co/t/get-document-aggregation-same-as-windows/114504/3 "2018-02-06T12:28:13Z")

</div>

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