That's way slicker than | metadata type=hosts index=foo | stats sum(totalCount)...awesome.
I found this article just now because I wanted to do something similar, but i have dozens of indexes, and wanted a sum by index over X time.
index=* | chart count(index) by index | sort - count(index) | rename count(index) as "Sum of Events"
6 years later, thanks!