Crystallize logo
More in Learn

Aggregations in Search Results

For further aggregating the results, the Search API provides the aggregations type. This type allows fetching price information, product variant attribute information, and more in the result set.

In order to perform these operations, ensure that you have the proper authentication (if necessary) and user permissions.

Aggregate Results

As mentioned above, to aggregate search results, the aggregations type is used. The following query is simply requesting the maximum and minimum price of the result set.

Circle loading spinnerImage of a partial circle indicating &qoute;loading&qoute;.Fetching snippet...

Count Queries

You can also count the number of items satisfying a particular criterion by using the count field. The query below retrieves all the products as well as the variants belonging to the search term 'sofa'. Then we use the aggregations type to get the topic names and the amount of variants belonging to each of the topics returned.

Circle loading spinnerImage of a partial circle indicating &qoute;loading&qoute;.Fetching snippet...
People showing thumbs up

Need further help?

Join and ask our
slack community.

Join our slack community