Given these docs (let's say they represent vehicles sold)
docA : { "make": "Ford", "model": "Mustang", "vehicleType": "SportsCar" }
docA : { "make": "Ford", "model": "Mustang", "vehicleType": "SportsCar" }
docA : { "make": "Ford", "model": "Taurus", "vehicleType": "Sedan" }
docA : { "make": "Chevrolet", "model": "Astro", "vehicleType": "Minivan" }
docA : { "make": "Chevrolet", "model": "Corvette", "vehicleType": "SportsCar" }
docA : { "make": "Chevrolet", "model": "Malibu", "vehicleType": "Sedan" }
I'd like to be able to display a dataset that looks like this:
**Make % Sports Cars % Minivans**
Ford 66% 0%
Chevrolet 33% 33%
Where I've gotten to, but I'm getting some odd errors, and I'm questioning my approach:
filters
| esdocs index="carsales" fields="make,vehicleType"
| ply by="make" fn={rowCount | as "row_count"}
| staticColumn column="allSalesByMake" value={ filters | escount { string "make:" make } index="carsales" }
// and then I planned on adding another static column, whose value was row_count / allSalesByMake
Is this the right approach? If so, I'm unable it seems to build a dynamic ES query and pass to escount ??