How to group timeseries data per month with ElasticSearch

Hey there,

I have time series data which should be grouped per month (and the count of the entries should be summed up per month) and grouped per product type. The goal of this is to visualize the result in a stacked bar chart like this.

My data source is ElasticSearch and the log table looks like this:

The result should look similar to this:
month | product type | count
4/21 | OnTimeMail | 4
4/21 | B2 | 2

As I am a complete newbie to both Grafana and ElasticSearch, I really appreciate any help you can possibly give me!