mirror of
https://github.com/elastic/elasticsearch.git
synced 2025-06-30 10:23:41 -04:00
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
58 lines
2.1 KiB
Text
58 lines
2.1 KiB
Text
[[search-aggregations-metrics]]
|
|
== Metrics Aggregations
|
|
|
|
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[]
|
|
|
|
include::metrics/boxplot-aggregation.asciidoc[]
|
|
|
|
include::metrics/cardinality-aggregation.asciidoc[]
|
|
|
|
include::metrics/extendedstats-aggregation.asciidoc[]
|
|
|
|
include::metrics/geobounds-aggregation.asciidoc[]
|
|
|
|
include::metrics/geocentroid-aggregation.asciidoc[]
|
|
|
|
include::metrics/geoline-aggregation.asciidoc[]
|
|
|
|
include::metrics/matrix-stats-aggregation.asciidoc[]
|
|
|
|
include::metrics/max-aggregation.asciidoc[]
|
|
|
|
include::metrics/median-absolute-deviation-aggregation.asciidoc[]
|
|
|
|
include::metrics/min-aggregation.asciidoc[]
|
|
|
|
include::metrics/percentile-rank-aggregation.asciidoc[]
|
|
|
|
include::metrics/percentile-aggregation.asciidoc[]
|
|
|
|
include::metrics/rate-aggregation.asciidoc[]
|
|
|
|
include::metrics/scripted-metric-aggregation.asciidoc[]
|
|
|
|
include::metrics/stats-aggregation.asciidoc[]
|
|
|
|
include::metrics/string-stats-aggregation.asciidoc[]
|
|
|
|
include::metrics/sum-aggregation.asciidoc[]
|
|
|
|
include::metrics/t-test-aggregation.asciidoc[]
|
|
|
|
include::metrics/tophits-aggregation.asciidoc[]
|
|
|
|
include::metrics/top-metrics-aggregation.asciidoc[]
|
|
|
|
include::metrics/valuecount-aggregation.asciidoc[]
|
|
|
|
include::metrics/weighted-avg-aggregation.asciidoc[]
|