Complete the code to calculate basic statistics on the field 'price'.
{
"aggs": {
"price_stats": {
"stats": {
"field": "[1]"
}
}
}
}The 'stats' aggregation requires the field name to calculate statistics. Here, 'price' is the correct field.
Complete the code to calculate extended statistics on the field 'score'.
{
"aggs": {
"score_extended_stats": {
"extended_stats": {
"field": "[1]"
}
}
}
}The 'extended_stats' aggregation calculates detailed stats on a numeric field. 'score' is the correct numeric field here.
Fix the error in the aggregation by completing the missing field name.
{
"aggs": {
"sales_stats": {
"stats": {
"field": "[1]"
}
}
}
}The 'stats' aggregation requires a numeric field. 'sales_amount' is numeric, while others are not.
Fill both blanks to calculate extended stats on 'temperature' and filter values greater than 20.
{
"aggs": {
"temp_stats": {
"extended_stats": {
"field": "[1]"
}
},
"filtered_temps": {
"filter": {
"range": {
"[2]": {
"gt": 20
}
}
}
}
}
}The aggregation and filter both use the 'temperature' field to calculate stats and filter values greater than 20.
Fill all three blanks to create an extended stats aggregation on 'duration', include a filter for values less than 100, and name the aggregation 'duration_stats'.
{
"aggs": {
"[1]": {
"extended_stats": {
"field": "[2]"
}
},
"filtered_duration": {
"filter": {
"range": {
"[3]": {
"lt": 100
}
}
}
}
}
}The aggregation is named 'duration_stats', operates on the 'duration' field, and the filter also applies to 'duration' values less than 100.