class VulnerabilityRepository implements Constants {

	public Map<String, Object> getUniqueApp(String assetGroup) {

		Map<String, Object> uniqueApp = new HashMap<>();
		StringBuilder urlToQuery = new StringBuilder(esUrl).append("/").append(assetGroup);
		urlToQuery.append("/").append("_search?filter_path=aggregations");
		StringBuilder requestBody = new StringBuilder(
				"{\"size\":0,\"query\":{\"bool\":{\"must\":[{\"match\":{\"latest\":true}},{\"match\":{\"_entity\":true}}]}},"
						+ "\"aggs\":{\"severity\":{\"filters\":{\"filters\":{"
						+ "\"S3\":{\"has_child\":{\"type\":\"vulninfo\",\"query\":{ \"bool\":{\"must\":[{\"match\":{\"latest\":true}},{\"match\":{\"severitylevel.keyword\":3}}]}}}},"
						+ "\"S4\":{\"has_child\":{\"type\":\"vulninfo\",\"query\":{ \"bool\":{\"must\":[{\"match\":{\"latest\":true}},{\"match\":{\"severitylevel.keyword\":4}}]}}}},"
						+ "\"S5\":{\"has_child\":{\"type\":\"vulninfo\",\"query\":{ \"bool\":{\"must\":[{\"match\":{\"latest\":true}},{\"match\":{\"severitylevel.keyword\":5}}]}}}}}},"
						+ "\"aggs\":{\"NAME\":{\"cardinality\":{\"field\":\"tags.Application.keyword\",\"precision_threshold\": 40000}}}}}}");
		String responseJson = "";
		try {
			responseJson = PacHttpUtils.doHttpPost(urlToQuery.toString(), requestBody.toString());
		} catch (Exception e) {
			LOGGER.error(Constants.ERROR_UNIQUEHOST, e);
		}
		JsonParser jsonParser = new JsonParser();
		if (StringUtils.isNotEmpty(responseJson)) {
			JsonObject resultJson = (JsonObject) jsonParser.parse(responseJson);
			JsonObject aggsJson = (JsonObject) jsonParser.parse(resultJson.get(AGGREGATIONS).toString());
			JsonObject buckets = aggsJson.getAsJsonObject(SEVERITY).getAsJsonObject(BUCKETS);
			for (int i = 3; i <= 5; i++) {
				uniqueApp.put(String.valueOf(i),
						buckets.get("S" + i).getAsJsonObject().get("NAME").getAsJsonObject().get(VALUE).getAsLong());
			}
		}
		return uniqueApp;
	}

}