Itās more efficient to do less searchesā¦ so load the data you need then filter it on the page.
Of course, itās not as simple as thatā¦ it depends on where and when you need to show the data, and whether youāre optimising for WU or for perceived page speed etc.
But generally, Iād recommend doing less searches, at least at the same time.
Butā¦ if, as your post suggest, youāre just counting the things in the database, then thatās completely different.
In that case you definitely donāt want to load all the data to the page, and then filter it, just to count it.
Doing separate agg searches (counts) is much better for that, although still not optimal.
A better way to do it is to search all the data, grouped by whatever it is you need to count (e.g. colour) with an aggregation of ācountā.
That way, you only make a single database query, and just get the counts of each colour in a single, low-cost, response from the database, rather than 3 separate counts (and definitely rather than loading all the data to the page).