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

[source, php]
----
$params = [
    'body' => [
        'aggs' => [
            'genres' => [
                'terms' => [
                    'script' => [
                        'source' => 'doc[\'genre\'].value',
                        'lang' => 'painless',
                    ],
                ],
            ],
        ],
    ],
];
$response = $client->search($params);
----
