Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 11 additions & 4 deletions docs/reference/aggregations/bucket/terms-aggregation.asciidoc
Original file line number Diff line number Diff line change
Expand Up @@ -60,16 +60,13 @@ GET /_search
{
"aggs": {
"genres": {
"terms": { "field": "genre" } <1>
"terms": { "field": "genre" }
}
}
}
--------------------------------------------------
// TEST[s/_search/_search\?filter_path=aggregations/]

<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
<<fielddata, fielddata>>.

Response:

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

[[search-aggregations-bucket-terms-aggregation-types]]
The `field` can be <<keyword>>, <<number>>, <<ip, `ip`>>, <<boolean, `boolean`>>,
or <<binary, `binary`>>.

NOTE: By default, you cannot run a `terms` aggregation on a `text` field. Use a
`keyword` <<multi-fields,sub-field>> instead. Alternatively, you can enable
<<fielddata,`fielddata`>> on the `text` field to create buckets for the field's
<<analysis,analyzed>> terms. Enabling `fielddata` can significantly increase
memory usage.

[[search-aggregations-bucket-terms-aggregation-size]]
==== Size

Expand Down