Improved script to count elasticsearch documents for each service.