Terms aggregation
> Documentation > Docs > INFINI Pizza > References > Aggregation > Terms aggregation

Terms aggregation #

A multi-bucket value source based aggregation where buckets are dynamically built - one per unique value.

Examples #

POST /_search
{
  "aggs": {
    "genres": {
      "terms": {
        "field": "genre"
      }
    }
  }
}

Response:

{
  ...
  "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
        }
      ]
    }
  }
}

Parameters for terms #

  • field
    (Required, string) Field you wish to aggregate.