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

Max aggregation #

A single-value metrics aggregation that keeps track and returns the maximum value among the numeric values extracted from the aggregated documents.

Examples #

Computing the max price value across all documents:

POST /sales/_search
{
  "aggs": {
    "max_price": {
      "max": {
        "field": "price"
      }
    }
  }
}

Response:

{
  ...
  "aggregations": {
    "max_price": {
      "value": 200.0
    }
  }
}

As can be seen, the name of the aggregation (max_price above) also serves as the key by which the aggregation result can be retrieved from the returned response.

Parameters for avg #

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