title: How do I get a count of documents (records) for each mapping type in ElasticSearch?
body: <p>I have an ElasticSearch index called "myindex" that I load documents into for three different mapping types (person, event, and vendor)...</p>
  
  <pre><code>curl -XPOST localhost:9200/myindex/person/_bulk --data-binary  @../JSON_DATA/persons.json
  curl -XPOST localhost:9200/myindex/event/_bulk --data-binary  @../JSON_DATA/events.json
  curl -XPOST localhost:9200/myindex/vendor/_bulk --data-binary  @../JSON_DATA/vendors.json
  </code></pre>
  
  <p>I can see that the index was created successfully by using the command:</p>
  
  <pre><code>curl 'localhost:9200/_cat/indices?v'
  </code></pre>
  
  <p>I can successfully list all mapping types by using the command:</p>
  
  <pre><code>curl -s -XGET 'http://localhost:9200/myindex/_mapping/?pretty'
  </code></pre>
  
  <p><strong>MY QUESTION - PART A:</strong> How do I get an aggregated/total count of documents <strong>for each and every</strong> mapping type in an explicitly named index ("myindex")?  In other words, I'd like to know the number of documents for each and every mapping type.</p>
  
  <p>NOTE: I tried <code>curl -s -XGET 'http://localhost:9200/myindex/_count/?pretty'</code> but it only returns the total count, across all mapping types, not by each mapping type.  In other words, it did not break down the county beach mapping type.</p>
  
  <p><strong>MY QUESTION - PART B:</strong> Given being able to get an aggregate/total count of documents for each mapping type, how do I get an aggregated count for any one specific mapping type stored in an explicitly named index ("myindex")?  In other words, I'd like to know the number of documents for one explicitly named mapping type (e.g. "event") under the index "myindex".</p>