Get a count of items in a bucket per day


Can someone help me to get a count of documents in a bucket per day for the last 10 days.
For example I would need somethins like this :

Day / NumberDocuments
20210826 / 100
20210825 / 123

20210816 / 134

Thank you very much,

Your question is a bit open ended: documents added? documents changed?

Unless you have a date field in your documents, this is the closest I can think of off hand:

select day, count(1) as `count` from default let day = millis_to_str(meta().cas/1000000,'1111-11-11') group by day order by day desc limit 10;

but that reports documents changed (includes being added) in the last 10 days, not necessarily just inserted.