Search This Blog

Monday, December 9, 2019

Elasticsearch aggregation - show aggregations only + overcome default limitation of aggregated buckets

Elasticsearch aggregation - output showing only aggregated field + overcoming default limitation of aggregated values (in this case, set to 1000)

GET customer_success_reports/_search
{
  "size":0,
    "aggs" : {
        "Country": {
            "composite" : {
              "size": 1000,
                "sources" : [
                    { "country": { "terms" : { "field": "Meta.GeoInfo.Country.keyword","missing_bucket": true } } }
                ]
            }
        }
     }
}


size:0 -> makes the output show the aggregated buckets only instead of the whole documents

No comments:

Post a Comment