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

[source, php]
----
$params = [
    'body' => [
        'aggs' => [
            'genres' => [
                'terms' => [
                    'field' => 'genre',
                    'order' => [
                        '_count' => 'asc',
                    ],
                ],
            ],
        ],
    ],
];
$response = $client->search($params);
----
