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

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