Get Document aggregation same as windows


(Krishna Raj) #1

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


(Luiz Santos) #2

Hi @krishnaraj221193,

Every bucket aggregation in elasticsearch returns the doc count associated with it.

For example, the terms aggregation 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


(system) #3

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