Metrics
Introduction
Metrics are aggregated values on the specified dimensions.
Two types of metrics exist: basic metric fields and custom aggregations.
Metric fields
A metric field is a plain field on which the aggregation operation is pre-defined. For example:
{
...,
"query": {
...,
"metrics": [
"crawl.20210102.count_urls_crawl",
"search_console.period_0.count_clicks"
],
...
}
}
crawl.20210102.count_urls_crawl
will count the number of different URLs that were crawledsearch_console.period_0.count_clicks
will sum the number of clicks that occurred on the specified dimensions
Here the aggregations are pre-defined, since you can only count the URLs and sum the clicks respectively.
Custom aggregations
For some fields, we require more flexibility and one can choose the aggregation that should be applied. This is done by applying a function to the field:
{
...,
"query": {
...,
"metrics": [
{
"function": "avg",
"args": ["crawl.20210102.depth"]
}
],
...
}
}
which will compute the average URL depth on each specified dimension.
Supported custom aggregation functions:
sum
avg
min
max
weighted_avg
(takes two input arguments)count
count_distinct
count_distinct_approx
count_true
count_false
count_null
count_eq
(takes two input arguments)count_gt
(takes two input arguments)count_gte
(takes two input arguments)count_lt
(takes two input arguments)count_lte
(takes two input arguments)
Updated over 3 years ago