title: How to filter terms aggregation
body: <p>Currently I have something like this</p>
  
  <pre><code>aggs: {
    categories: {
      terms: {
        field: 'category'
      }
    }
  }
  </code></pre>
  
  <p>and this is giving me number of products in each category. But I have additional condition. I need to get number of products in each category which are not sold already, so I need to perform filter on <code>terms</code> somehow.</p>
  
  <p>Is there some elegant way of doing this using aggregation framework, or I need to write filtered query?</p>
  
  <p>Thank you</p>