If one wants to count the number of documents in an index (of Elasticsearch) then there are (at least?) two possibilities:
Direct count
The two queries provide the same result but: - count consumes less resources/bandwidth because doesn't require to fetch documents, scoring and other internal optimizations. Set the search size to 0, could be very similar.
If you want count all the record in an index, you can also execute an aggregation terms on "_type" field.
The results should be the same. Before comparing the results, be sure to execute an index refresh.