A. {"aggregations":{"max_response_time":{"value":500000}}}
B. {"hits":{"total":100}}
C. {"error":"Field not found"}
D. {"aggregations":{"avg_response_time":{"value":250000}}}
Solution
Step 1: Understand aggregation type
The query requests the average of the field "transaction.duration.us" which holds response times in microseconds.
Step 2: Match output to aggregation
The output shows an aggregation named "avg_response_time" with a numeric value representing the average, matching {"aggregations":{"avg_response_time":{"value":250000}}}.
Final Answer:
{"aggregations":{"avg_response_time":{"value":250000}}} -> Option D
Quick Check:
Average aggregation output = {"aggregations":{"avg_response_time":{"value":250000}}} [OK]
Hint: Aggregation output shows "aggregations" with average value [OK]
Common Mistakes:
Confusing hits total with aggregation result
Expecting max instead of avg
Assuming error without checking field existence
4. You run this Elasticsearch query to get average response time but get an error: Fielddata is disabled on text fields by default. What is the likely cause?
medium
A. Trying to aggregate on a text field instead of a numeric field
B. Using the wrong index pattern in the query
C. Missing authentication credentials
D. Query syntax error in aggregation block
Solution
Step 1: Analyze error message
The error says fielddata is disabled on text fields, which means aggregation was attempted on a text field.
Step 2: Understand aggregation requirements
Aggregations like average require numeric fields, so using a text field causes this error.
Final Answer:
Trying to aggregate on a text field instead of a numeric field -> Option A
Quick Check:
Fielddata error = Aggregation on text field [OK]
Hint: Average needs numeric field, not text [OK]
Common Mistakes:
Blaming index pattern or auth for this error
Assuming syntax error without checking field type
Ignoring field data type requirements
5. You want to monitor the average response time for your app but only for transactions with errors. Which Elasticsearch query snippet correctly filters and calculates this?