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

[source, php]
----
$params = [
    'body' => [
        'aggs' => [
            'genres' => [
                'terms' => [
                    'script' => [
                        'id' => 'my_script',
                        'params' => [
                            'field' => 'genre',
                        ],
                    ],
                ],
            ],
        ],
    ],
];
$response = $client->search($params);
----
