Challenge - 5 Problems
Metric Aggregations Master
Get all challenges correct to earn this badge!
Test your skills under time pressure!
❓ Predict Output
intermediate2:00remaining
What is the output of this average aggregation?
Given the following Elasticsearch aggregation query, what is the average value returned for the field
price?Elasticsearch
{
"size": 0,
"aggs": {
"average_price": {
"avg": {
"field": "price"
}
}
}
}Attempts:
2 left
💡 Hint
The average aggregation calculates the mean of all values in the
price field.✗ Incorrect
The average aggregation returns the mean of the
price field values across all documents. Here, the expected average is 25.5.❓ Predict Output
intermediate2:00remaining
What is the sum of the
quantity field?Consider this Elasticsearch aggregation query. What sum value will it return for the
quantity field?Elasticsearch
{
"size": 0,
"aggs": {
"total_quantity": {
"sum": {
"field": "quantity"
}
}
}
}Attempts:
2 left
💡 Hint
Sum aggregation adds all values of the specified field.
✗ Incorrect
The sum aggregation returns the total sum of all
quantity values in the documents, which is 100 in this case.❓ Predict Output
advanced2:00remaining
What is the minimum value returned by this aggregation?
Analyze this Elasticsearch aggregation query. What minimum value will it return for the
rating field?Elasticsearch
{
"size": 0,
"aggs": {
"min_rating": {
"min": {
"field": "rating"
}
}
}
}Attempts:
2 left
💡 Hint
Minimum aggregation finds the smallest value in the field.
✗ Incorrect
The minimum aggregation returns the smallest
rating value found in the documents, which is 1 here.❓ Predict Output
advanced2:00remaining
What maximum value does this aggregation return?
Given this Elasticsearch aggregation query, what is the maximum value returned for the
score field?Elasticsearch
{
"size": 0,
"aggs": {
"max_score": {
"max": {
"field": "score"
}
}
}
}Attempts:
2 left
💡 Hint
Maximum aggregation finds the largest value in the field.
✗ Incorrect
The maximum aggregation returns the highest
score value found in the documents, which is 99 here.🧠 Conceptual
expert2:00remaining
Which aggregation returns
null value and why?In Elasticsearch, when running a metric aggregation like
avg, sum, min, or max on a field that has no matching documents, what value is returned and why?Attempts:
2 left
💡 Hint
Think about what happens when there is no data to aggregate.
✗ Incorrect
When no documents match the query, metric aggregations return
null because there is no value to compute. They do not default to zero or throw errors.