How to get the total documents count, containing a specific field, using aggregations?
<p>I am moving from ElasticSearch 1.7 to 2.0. Previously while calculating Term Facets I got the Total Count as well. This will tell in how many documents  that field exists. This is how I was doing previously.</p>

<pre><code>TermsFacet termsFacet = (TermsFacet) facet;
termsFacet.getTotalCount();
</code></pre>

<p>It worked with Multivalue field as well.</p>

<p>Now in current version for Term Aggregation we don't have anything as Total Count. I am getting DocCount inside Aggregation bucket. But that will  not work for muti-valued fields.</p>

<pre><code>Terms termsAggr = (Terms) aggr;
for (Terms.Bucket bucket : termsAggr.getBuckets()) {
                    String bucketKey = bucket.getKey();
                    totalCount += bucket.getDocCount();
 }
</code></pre>

<p>Is there any way I can get Total count of the field from term aggregation.
I don't want to fire exists Filter query. I want result in single query.</p>