why you want to use tstats if the second solution solves your needs?
If the problem is performance, use
| metasearch before index=*
To add to this post for future readers, if you did want to use tstats, then you could using the following syntax:
| tstats count WHERE (index=*) BY index _time span=1d prestats=t | timechart span=1d count by index
adjust the span period (on both lines as they must match) to whatever you prefer based on your search (1h, 4h, 5m, etc...)