class RecommendationsRepository {

    public List<Map<String,Object>> getGeneralRecommendationSummary(List<String> providers) throws DataException {
    	
    	List<Map<String,Object>> recommendationSummary = new ArrayList<>();
    	StringBuilder urlToQuery = new StringBuilder(esUrl).append("/").append("global_recommendations").append("/")
    			.append("recommendation").append("/").append(Constants.SEARCH);
		StringBuilder requestBody = new StringBuilder("{\"size\":0,\"query\":{\"bool\": {\"filter\":[{\"term\":{\"latest\":\"true\"}},{\"terms\":{\"_cloudType\":[\"");
		requestBody.append(String.join("\",\" ", providers.stream().collect(Collectors.toList())));
		requestBody.append("\"]}}]}},\"aggs\":{\"category\":{\"terms\":{\"field\":\"category.keyword\",\"size\":100}}}}");
		
		String responseDetails;
		try {
			responseDetails = PacHttpUtils.doHttpPost(urlToQuery.toString(), requestBody.toString());
		} catch (Exception e) {
			LOGGER.error("Error in getGlobalRecommendationSummary "+e);
			throw new DataException(e);
		}
        JsonParser parser = new JsonParser();
        JsonObject responseDetailsjson = parser.parse(responseDetails).getAsJsonObject();
        JsonObject aggregations = responseDetailsjson.get(Constants.AGGREGATIONS).getAsJsonObject();
        
		if (aggregations != null) {

			JsonArray categoryBuckets = aggregations.get("category").getAsJsonObject().get(Constants.BUCKETS)
					.getAsJsonArray();
			if (categoryBuckets.size() > 0) {
				for (int i = 0; i < categoryBuckets.size(); i++) {
					JsonObject categoryObj = (JsonObject) categoryBuckets.get(i);
					if (categoryObj != null) {
						Map<String, Object> category = new HashMap<>();
						category.put("category", categoryObj.get("key").getAsString());
						category.put("recommendations", categoryObj.get("doc_count").getAsLong());
						recommendationSummary.add(category);
					}
				}
			} else {
				//   passing 0 values if there are no recommendations
				String[] categories = recommendationCategories.split(",");
				for (int i = 0; i < categories.length; i++) {
					Map<String, Object> category = new HashMap<>();
					category.put("category", categories[i]);
					category.put("recommendations", 0L);
					recommendationSummary.add(category);
				}
			}
		}
        return recommendationSummary;
    }

}