2015-05-02 04:04:55 +08:00
|
|
|
[[search-aggregations-metrics]]
|
2021-01-14 03:44:54 +08:00
|
|
|
== Metrics aggregations
|
2015-05-02 04:04:55 +08:00
|
|
|
|
|
|
|
The aggregations in this family compute metrics based on values extracted in one way or another from the documents that
|
|
|
|
are being aggregated. The values are typically extracted from the fields of the document (using the field data), but
|
|
|
|
can also be generated using scripts.
|
|
|
|
|
|
|
|
Numeric metrics aggregations are a special type of metrics aggregation which output numeric values. Some aggregations output
|
|
|
|
a single numeric metric (e.g. `avg`) and are called `single-value numeric metrics aggregation`, others generate multiple
|
|
|
|
metrics (e.g. `stats`) and are called `multi-value numeric metrics aggregation`. The distinction between single-value and
|
|
|
|
multi-value numeric metrics aggregations plays a role when these aggregations serve as direct sub-aggregations of some
|
|
|
|
bucket aggregations (some bucket aggregations enable you to sort the returned buckets based on the numeric metrics in each bucket).
|
|
|
|
|
|
|
|
include::metrics/avg-aggregation.asciidoc[]
|
|
|
|
|
2020-05-16 04:34:47 +08:00
|
|
|
include::metrics/boxplot-aggregation.asciidoc[]
|
|
|
|
|
2015-05-02 04:04:55 +08:00
|
|
|
include::metrics/cardinality-aggregation.asciidoc[]
|
|
|
|
|
|
|
|
include::metrics/extendedstats-aggregation.asciidoc[]
|
|
|
|
|
|
|
|
include::metrics/geobounds-aggregation.asciidoc[]
|
|
|
|
|
2015-09-17 05:54:54 +08:00
|
|
|
include::metrics/geocentroid-aggregation.asciidoc[]
|
|
|
|
|
Add geo_line aggregation (#41612)
A metric aggregation that aggregates a set of points as
a GeoJSON LineString ordered by some sort parameter.
#### specifics
A `geo_line` aggregation request would specify a `geo_point` field, as well
as a `sort` field. `geo_point` represents the values used in the LineString,
while the `sort` values will be used as the total ordering of the points.
the `sort` field would support any numeric field, including date.
#### sample usage
```
{
"query": {
"bool": {
"must": [
{ "term": { "person": "004" } },
{ "term": { "trajectory": "20090131002206.plt" } }
]
}
},
"aggs": {
"make_line": {
"geo_line": {
"point": {"field": "location"},
"sort": { "field": "timestamp" },
"include_sort": true,
"sort_order": "desc",
"size": 15
}
}
}
}
```
#### sample response
```
{
"took": 21,
"timed_out": false,
"_shards": {...},
"hits": {...},
"aggregations": {
"make_line": {
"type": "LineString",
"coordinates": [
[
121.52926194481552,
38.92878997139633
],
[
121.52922699227929,
38.92876998055726
],
]
}
}
}
```
#### visual response
<img width="540" alt="Screen Shot 2019-04-26 at 9 40 07 AM" src="https://user-images.githubusercontent.com/388837/56834977-cf278e00-6827-11e9-9c93-005ed48433cc.png">
#### limitations
Due to the cardinality of points, an initial max of 10k points
will be used. This should support many use-cases.
One solution to overcome this limitation is to keep a PriorityQueue of
points, and simplifying the line once it hits this max. If simplifying
makes sense, it may be a nice option, in general. The ability to use a parameter
to specify how aggressive one wants to simplify. This parameter could be
the number of points. Example algorithm one could use with a PriorityQueue:
https://bost.ocks.org/mike/simplify/. This would still require O(m) space, where m
is the number of points returned. And would also require heapifying triangles
sorted by their areas, which would be O(log(m)) operations. Since sorting is done,
anyways, simplifying would still be a O(n log(m)) operation, where n is the total number
of points to filter........... something to explore
closes #41649
2020-11-24 02:26:27 +08:00
|
|
|
include::metrics/geoline-aggregation.asciidoc[]
|
|
|
|
|
2020-10-31 01:25:21 +08:00
|
|
|
include::metrics/matrix-stats-aggregation.asciidoc[]
|
2020-10-30 20:39:38 +08:00
|
|
|
|
2015-05-02 04:04:55 +08:00
|
|
|
include::metrics/max-aggregation.asciidoc[]
|
|
|
|
|
2020-10-31 01:25:21 +08:00
|
|
|
include::metrics/median-absolute-deviation-aggregation.asciidoc[]
|
|
|
|
|
2015-05-02 04:04:55 +08:00
|
|
|
include::metrics/min-aggregation.asciidoc[]
|
|
|
|
|
2020-10-31 01:25:21 +08:00
|
|
|
include::metrics/percentile-rank-aggregation.asciidoc[]
|
2020-05-16 04:34:47 +08:00
|
|
|
|
2015-05-02 04:04:55 +08:00
|
|
|
include::metrics/percentile-aggregation.asciidoc[]
|
|
|
|
|
2020-10-31 01:25:21 +08:00
|
|
|
include::metrics/rate-aggregation.asciidoc[]
|
2015-05-02 04:04:55 +08:00
|
|
|
|
|
|
|
include::metrics/scripted-metric-aggregation.asciidoc[]
|
|
|
|
|
2020-10-31 01:25:21 +08:00
|
|
|
include::metrics/stats-aggregation.asciidoc[]
|
|
|
|
|
2019-11-14 22:07:54 +08:00
|
|
|
include::metrics/string-stats-aggregation.asciidoc[]
|
|
|
|
|
2015-05-02 04:04:55 +08:00
|
|
|
include::metrics/sum-aggregation.asciidoc[]
|
|
|
|
|
2020-10-31 01:25:21 +08:00
|
|
|
include::metrics/t-test-aggregation.asciidoc[]
|
|
|
|
|
2015-05-02 04:04:55 +08:00
|
|
|
include::metrics/tophits-aggregation.asciidoc[]
|
|
|
|
|
2020-02-14 20:13:52 +08:00
|
|
|
include::metrics/top-metrics-aggregation.asciidoc[]
|
|
|
|
|
2015-05-02 04:04:55 +08:00
|
|
|
include::metrics/valuecount-aggregation.asciidoc[]
|
|
|
|
|
2020-10-31 01:25:21 +08:00
|
|
|
include::metrics/weighted-avg-aggregation.asciidoc[]
|