Fetching Top Search Terms for a Given Time Period


I am creating a mobile application where I want display search suggestions based on the most popular search terms for my search experience. I also want to make sure that these search terms actually return results when they are searched.

I basically want to fetch the info found in the photo I have attached via REST API but filter out Unknown and any terms that don’t have results.

What’s the best way to do this?