Do Count Aggregation on Missing Fiels


(Kevin M.) #1

I have a requirement to generate a report of the counts of documents in my index that do not have values for a list of specific fields and here is what I have so far:

http://my.host.name:9200/myIndex/myType/_count?pretty=true
{
"query": {
"bool": {
"must_not": {
"exists": {
"field": "event_name"
}
}
}
}
}

This works as expected and I just get the count for those documents that are missing the event_name. The problem is I have like 25 fields that I am interested in and I am not sure how to wire up an aggregation to do the same thing for all 25 fields with a single query. Is it possible to do that with the _count end point and an aggregation? If so, can someone provide a sample to get me started? Right now I am executing 25 separate queries in succession and that is taking about 45 seconds to run given the number of documents I am running against (70+ million) and I would like to speed that up since I want to spit out the results on a Web page. Thanks.

Kevin


(system) #2

This topic was automatically closed 28 days after the last reply. New replies are no longer allowed.