I have a documents collection in cloudant
{
"id" : String
"state": String
"city": String
"zipcode": int
"productType": String
"make": String
"model": String
"sku": String
"usedOn": Date
"energyUSed": int
"durationUsed": int
}
I would like to filter on multiple criterias - state, city, zipcode, make, model, sku etc and aggregate energyUsed and durationUsed
I looked at querying cloudant using map/reduce, query indexes and _find target. However none of these is flexible enough to filter and aggregate at multiple levels.
For example, I would like to filter based on make and model, and aggregate at state or city level. In another case, I would like to filter based on state, city, make and model and aggregate at month level (using usedOn).
Any help is much appreciated.