Recall & Review
beginner
What is Cardinality aggregation in Elasticsearch?
Cardinality aggregation counts the number of unique values for a specific field in your data. It's like counting how many different types of fruits are in a basket.
Click to reveal answer
intermediate
How does Cardinality aggregation handle approximate counts?
It uses an algorithm that estimates unique counts quickly with a small margin of error, which is faster and uses less memory than exact counting.
Click to reveal answer
intermediate
Which parameter controls the precision of Cardinality aggregation?
The 'precision_threshold' parameter controls how accurate the count is. Higher values mean more accuracy but use more memory.
Click to reveal answer
beginner
Write a simple Cardinality aggregation query to count unique user IDs.
{
"aggs": {
"unique_users": {
"cardinality": {
"field": "user_id"
}
}
}
}
Click to reveal answer
intermediate
Why might you choose Cardinality aggregation over Terms aggregation for counting unique values?
Cardinality aggregation is more efficient for counting unique values when you don't need to list all values. Terms aggregation returns buckets for each value, which can be slow and memory-heavy for many unique values.
Click to reveal answer
What does Cardinality aggregation count in Elasticsearch?
✗ Incorrect
Cardinality aggregation counts the number of unique values in a specified field.
Which parameter adjusts the accuracy of Cardinality aggregation?
✗ Incorrect
The 'precision_threshold' parameter controls the accuracy of the cardinality count.
What is a benefit of using Cardinality aggregation over Terms aggregation for unique counts?
✗ Incorrect
Cardinality aggregation is optimized for counting unique values efficiently without returning all values.
If you want an exact unique count with no approximation, what should you do?
✗ Incorrect
Terms aggregation returns exact buckets but can be costly; Cardinality aggregation is approximate.
What type of data is Cardinality aggregation best suited for?
✗ Incorrect
Cardinality aggregation works well for fields with many unique values to efficiently estimate counts.
Explain how Cardinality aggregation works and when you would use it.
Think about counting different items quickly without listing them all.
You got /4 concepts.
Describe the difference between Cardinality aggregation and Terms aggregation.
Consider what happens when you have many unique values.
You got /4 concepts.