// aggregations/bucket/terms-aggregation.asciidoc:162

[source, php]
----
$params = [
    'body' => [
        'aggs' => [
            'products' => [
                'terms' => [
                    'field' => 'product',
                    'size' => 5,
                    'show_term_doc_count_error' => true,
                ],
            ],
        ],
    ],
];
$response = $client->search($params);
----
