Skip to content

Commit

Permalink
[DOCS] Clarify supported fields for top_metrics agg (#73907) (#73917)
Browse files Browse the repository at this point in the history
Changes:
* Notes `metrics.field` supports `boolean` fields and runtime fields.
* Notes `metrics.field` doesn't support array values.

Closes #72889
  • Loading branch information
jrodewig authored Jun 8, 2021
1 parent 5943cd5 commit 77268d7
Showing 1 changed file with 15 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -70,10 +70,21 @@ request. So,
==== `metrics`

`metrics` selects the fields of the "top" document to return. You can request
a single metric with something like `"metric": {"field": "m"}` or multiple
metrics by requesting a list of metrics like `"metric": [{"field": "m"}, {"field": "i"}`.
The fields can be <<number,numbers>>, <<keyword,keywords>>, or <<ip,ips>>.
Here is a more complete example:
a single metric with something like `"metrics": {"field": "m"}` or multiple
metrics by requesting a list of metrics like `"metrics": [{"field": "m"}, {"field": "i"}`.

`metrics.field` supports the following field types:

* <<boolean,`boolean`>>
* <<ip,`ip`>>
* <<keyword,keywords>>
* <<number,numbers>>

Except for keywords, <<runtime,runtime fields>> for corresponding types are also
supported. `metrics.field` doesn't support fields with <<array,array values>>. A
`top_metric` aggregation on array values may return inconsistent results.

The following example runs a `top_metrics` aggregation on several field types.

[source,console,id=search-aggregations-metrics-top-metrics-list-of-metrics]
----
Expand Down

0 comments on commit 77268d7

Please sign in to comment.