Skip to content

Commit 53e652b

Browse files
nik9000jrodewig
andauthored
Document types terms agg can consume (#73272) (#74259)
Co-authored-by: James Rodewig <[email protected]> Co-authored-by: James Rodewig <[email protected]>
1 parent bd61d81 commit 53e652b

File tree

1 file changed

+11
-4
lines changed

1 file changed

+11
-4
lines changed

docs/reference/aggregations/bucket/terms-aggregation.asciidoc

Lines changed: 11 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -60,16 +60,13 @@ GET /_search
6060
{
6161
"aggs": {
6262
"genres": {
63-
"terms": { "field": "genre" } <1>
63+
"terms": { "field": "genre" }
6464
}
6565
}
6666
}
6767
--------------------------------------------------
6868
// TEST[s/_search/_search\?filter_path=aggregations/]
6969

70-
<1> `terms` aggregation should be a field of type `keyword` or any other data type suitable for bucket aggregations. In order to use it with `text` you will need to enable
71-
<<fielddata, fielddata>>.
72-
7370
Response:
7471

7572
[source,console-result]
@@ -107,6 +104,16 @@ Response:
107104
By default, the `terms` aggregation will return the buckets for the top ten terms ordered by the `doc_count`. One can
108105
change this default behaviour by setting the `size` parameter.
109106

107+
[[search-aggregations-bucket-terms-aggregation-types]]
108+
The `field` can be <<keyword>>, <<number>>, <<ip, `ip`>>, <<boolean, `boolean`>>,
109+
or <<binary, `binary`>>.
110+
111+
NOTE: By default, you cannot run a `terms` aggregation on a `text` field. Use a
112+
`keyword` <<multi-fields,sub-field>> instead. Alternatively, you can enable
113+
<<fielddata,`fielddata`>> on the `text` field to create buckets for the field's
114+
<<analysis,analyzed>> terms. Enabling `fielddata` can significantly increase
115+
memory usage.
116+
110117
[[search-aggregations-bucket-terms-aggregation-size]]
111118
==== Size
112119

0 commit comments

Comments
 (0)