I need to get the number of documents in an index. not the documents themselves, but just this "how many" .

What's the best way to do that?

There is <https://www.elastic.co/guide/en/elasticsearch/reference/current/search-count.html>. but I'm looking to do this in Java. 

There also is <https://www.elastic.co/guide/en/elasticsearch/client/java-api/2.4/count.html>, but it seems way old. 

I can get all the documents in the given index and come up with "how many". But there must be a better way.