Is there a way to do a "multi value count" aggregation? It would work the same way as the regular value count: http://www.elasticsearch.org/guide/en/elasticsearch/reference/current/search-aggregations-metrics-valuecount-aggregation.html
But would be used to count multiple fields.
For example we have a mapping:
"properties" : {
"lastName" : { "type" : "string" },
"firstName" : { "type" : "string" },
"age" : { "type" : "string" }
}
And the following 4 docs:
{"lastName":"Smith"}
{"lastName":"Jacobson", "firstName":"Scott"}
{"lastName":"Bush", "age": 68}
{"lastName":"Obama", "firstName":"Barack", "age":53}
I would like to count the number of documents with either an age OR a first name. In my case the aggregation would return 3.
Any idea ? I try a little bit using the script function:
"aggregation_name" : {
"value_count" : {
"script" : "doc['age'].value + doc['firstName'].value"
}
}
but it did't seem to work.
Thanks!