To consider only certain indexes, include those index names in the query.
| tstats values(sourcetype) AS Sourcetype dc(sourcetype) AS #sourcetypes WHERE (index=os OR index=main OR index=tomcat) by host
The tstats command doesn't have app information available in most cases as events typically do not contain that field. There are REST commands you can use to try to map sourcetype to app, but understand that there may be more than one app associated with a given sourcetype.
--- If this reply helps you, Karma would be appreciated.