Min aggregation

Min aggregation #

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

Examples #

Computing the min price value across all documents:

POST /sales/_search
{
  "aggs": {
    "min_price": {
      "min": {
        "field": "price"
      }
    }
  }
}

Response:

{
  ...
  "aggregations": {
    "min_price": {
      "value": 10.0
    }
  }
}

As can be seen, the name of the aggregation (min_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.
Calendar August 28, 2024
Edit Edit this page