Challenge - 5 Problems
Bucket Aggregation Master
Get all challenges correct to earn this badge!
Test your skills under time pressure!
❓ Predict Output
intermediate2:00remaining
Output of a terms aggregation query
What is the output of this Elasticsearch aggregation query on an index with documents containing a
category field?Elasticsearch
{
"size": 0,
"aggs": {
"category_counts": {
"terms": {
"field": "category.keyword",
"size": 3
}
}
}
}Attempts:
2 left
💡 Hint
Terms aggregation groups documents by unique values of the specified field and counts them.
✗ Incorrect
The terms aggregation groups documents by the unique values in the 'category.keyword' field and returns the top 3 terms with their document counts. Option A shows the correct counts and keys.
❓ Predict Output
intermediate2:00remaining
Histogram aggregation bucket counts
Given this histogram aggregation query on a field
price, what is the number of buckets returned?Elasticsearch
{
"size": 0,
"aggs": {
"price_ranges": {
"histogram": {
"field": "price",
"interval": 50
}
}
}
}Attempts:
2 left
💡 Hint
Histogram buckets are created by dividing the range of values by the interval.
✗ Incorrect
The histogram aggregation creates buckets of size 50 for the price field. Given the data range, it results in 5 buckets.
🧠 Conceptual
advanced1:30remaining
Understanding bucket aggregation behavior
Which statement correctly describes how the
terms aggregation orders buckets by default?Attempts:
2 left
💡 Hint
Think about which buckets Elasticsearch shows first by default.
✗ Incorrect
By default, terms aggregation orders buckets by their document count in descending order, showing the most frequent terms first.
❓ Predict Output
advanced1:30remaining
Error from invalid histogram interval
What error does this histogram aggregation query produce?
Elasticsearch
{
"size": 0,
"aggs": {
"price_histogram": {
"histogram": {
"field": "price",
"interval": 0
}
}
}
}Attempts:
2 left
💡 Hint
Histogram interval cannot be zero or negative.
✗ Incorrect
The histogram aggregation requires a positive interval. Zero interval causes an error indicating the interval must be greater than 0.
🚀 Application
expert3:00remaining
Combining terms and histogram aggregations
You want to find the count of documents grouped first by
category.keyword and then by price ranges of 100. Which aggregation structure achieves this?Attempts:
2 left
💡 Hint
The first aggregation groups by category, then inside each category bucket, the histogram groups by price ranges.
✗ Incorrect
Option B correctly nests a terms aggregation on 'category.keyword' with a sub-aggregation histogram on 'price' with interval 100. Other options misuse field types or order.