Complete the code to specify the cardinality aggregation field.
{
"aggs": {
"unique_users": {
"cardinality": {
"field": "[1]"
}
}
}
}The cardinality aggregation counts unique values of the specified field. Here, user_id is the correct field to count unique users.
Complete the code to set the precision threshold for the cardinality aggregation.
{
"aggs": {
"unique_users": {
"cardinality": {
"field": "user_id",
"[1]": 1000
}
}
}
}The precision_threshold controls the accuracy of the cardinality aggregation. Higher values increase accuracy but use more memory.
Fix the error in the aggregation type to correctly perform cardinality aggregation.
{
"aggs": {
"unique_users": {
"[1]": {
"field": "user_id"
}
}
}
}The aggregation type must be cardinality to count unique values. Other types like terms or avg do different aggregations.
Fill both blanks to create a cardinality aggregation with a custom name and field.
{
"aggs": {
"[1]": {
"cardinality": {
"field": "[2]"
}
}
}
}The aggregation is named unique_visitors and counts unique values in the user_id field.
Fill all three blanks to create a cardinality aggregation with a name, field, and precision threshold.
{
"aggs": {
"[1]": {
"cardinality": {
"field": "[2]",
"[3]": 2000
}
}
}
}The aggregation is named unique_customers, counts unique customer_id values, and sets precision_threshold to 2000 for accuracy.