title: Unique count of terms aggregations
body: <p>I want to count distinct values of a field from my dataset. For example:</p>
  
  <p>The <code>terms</code> aggregation gives me the number of occurences by <code>username</code>. I want to only count <strong>unique</strong> usernames, not all.</p>
  
  <p>Here's my request:</p>
  
  <pre><code>POST appzz/messages/_search
  {
     "aggs": {
        "words": {
           "terms": {
              "field": "username"
           }
        }
     },
     "size": 0,
     "from": 0
  }
  </code></pre>
  
  <p>Is there a <code>unique</code> option or something like that?</p>