Terms Aggregation
Terms Aggregation is a bucket aggregation that allows you to group documents into buckets based on the values of a specific field.
Example -
{
"query": {
"bool": {
"must": {
"term": {"product_type_name": "Dress"}
}
}
},
"aggs": {
"unique_products": {
"terms": {
"field": "prod_name"
}
}
}
}
In the above example, the aggregation will be performed over the field "unique_products" over all documents that pass the query. The aggregation results will be stored under buckets, according to the possible value of the field "prod_name".
Last updated