Let's suppose we have a fairly large database of products for e.g. 50 K Mobile Phone. We store these data in Elastic Search. Now I have a Product Listing page for mobile phone, there I list all mobile 10 at a time using pagination with their basic details. That page also have a filter section like Brand, Price Range, RAM, Avg. Rating, Release date and lot more specifications.
Now When I fetch for mobile of Samsung company and 6 GB ram, I fire a elastic query and got results and their total count. So here bring the count query become complex, Total count depends on filter and this type of query increases load on system.
I want a system which will compute count for filters once and save it somewhere so I don't need to calculate count for same filter again, thus reducing complexity overhead for same filters again and again. Let me know with your knowledge How I can solve this problem or how should I maintain my system?
Any reference or article would also be appreciated.