How can I get the count of all indices?

Welcome!

You can use the _cat API.

Something like:

curl localhost:9200/_cat/indices | wc -l

You can try something like:

curl localhost:9200/_cat/indices/*,-.* | wc -l

Not tested but I think it should exclude indices starting with a dot.