How does Cartesian Product Join work in Spark?
January 29, 2021Why does Hadoop need classes like Text instead of String?
February 3, 2021It is quite common that you have a need to find the count of the number of documents in an Elasticsearch index. There are several ways to find this. Here are couple of ways.
Solution
_count
Use this method if you are trying to get the count programmatically.
[osboxes@wk1 ~]$ curl "localhost:9200/account/_count" {"count":1000,"_shards":{"total":1,"successful":1,"skipped":0,"failed":0}}
_cat
This list all the indices in your cluster and it lists the information about all the indices in a nice tabular format.
[osboxes@wk1 ~]$ curl http://localhost:9200/_cat/indices?v health status index uuid pri rep docs.count docs.deleted store.size pri.store.size yellow open account avtO6o3jTmWtgAyQwTTM6Q 1 1 1000 0 391.4kb 391.4kb