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

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