Max Aggregation
The max aggregation finds the maximum value of a numeric field. Let’s find the maximum price of products.
Query:
GET /products/_search
{
"size": 0,
"aggs": {
"max_price": {
"max": {
"field": "price"
}
}
}
}
Output
{
"aggregations": {
"max_price": {
"value": 1000.0
}
}
}
In this example, the maximum price of products is $1000.0.
Metric Aggregation in Elasticsearch
Elasticsearch is a powerful tool not just for search but also for performing complex data analytics. Metric aggregations are a crucial aspect of this capability, allowing users to compute metrics like averages, sums, and more on numeric fields within their data.
This guide will delve into metric aggregations in Elasticsearch, explaining what they are, how they work, and providing detailed examples to illustrate their use.
Contact Us