title: Using filters to count values in Kibana / Visualize?
body: <p>(I am quite new to ELK stack and may ask something obvious...)</p>
  
  <p>I have documents describing customers informations, with data such as name, address, age, etc...
  Sometimes, not all these fields exist and I would like to know the number of documents having them filled.</p>
  
  <p>If the data looks like:</p>
  
  <pre><code>PUT customers
  {
    "mappings": {
      "customer": {
        "properties": {
          "id": {
            "type": "integer"
          },
          "category": {
            "type": "keyword"
          },
          "email": {
            "type": "text"
          },
          "age": {
            "type": "integer"
          },
          "address": {
            "type": "text"
          }
        }
      }
    }
  }
  
  
  POST _bulk
  {"index":{"_index":"customers","_type":"customer"}}
  {"id":"1","category":"aa","email":"sam@test.com"}
  {"index":{"_index":"customers","_type":"customer"}}
  {"id": "2", "category" : "aa", "age": "5"}
  {"index":{"_index":"customers","_type":"customer"}}
  {"id": "3", "category" : "aa", "email": "bob@test.com", "age": "36"}
  {"index":{"_index":"customers","_type":"customer"}}
  {"id": "4", "category" : "bb", "email": "kim@test.com", "age": "42", "address": "london"}
  </code></pre>
  
  <p>The idea is to have in <strong>Kibana visualize</strong> a data table like :</p>
  
  <pre><code>+----------+-------+-------+-----+---------+
  | category | total | email | age | address |
  +----------+-------+-------+-----+---------+
  | aa       |     3 |     2 |   2 |       0 |
  | bb       |     1 |     1 |   1 |       1 |
  +----------+-------+-------+-----+---------+
  </code></pre>
  
  <p>(eg: we have 3 customers in category "aa"; among them 2 gave their email, 2 gave their age, none gave its address)</p>
  
  <p>I can figure out how to do that with a query like:</p>
  
  <pre><code>POST /customers/_search?size=0
  {
    "aggs": {
      "category": {
        "terms": {
          "field": "category"
        },
        "aggs": {
          "count_email": {
            "filter": {
              "exists": {
                "field": "email"
              }
            }
          },
          "count_age": {
            "filter": {
              "exists": {
                "field": "age"
              }
            }
          },
          "count_address": {
            "filter": {
              "exists": {
                "field": "address"
              }
            }
          }
        }
      }
    }
  }
  </code></pre>
  
  <p>But I can't find how we can do that in Kibana Visualize.
  Should I use scripted fields ? JSON inputs ? how ? is there a better way ?</p>
  
  <p>Thanks for your advices.</p>