class VulnerabilityRepository implements Constants {

	public long getRunningInstancesCount(String index, String vulnType) throws DataException {
		StringBuilder urlToQuery = new StringBuilder(esUrl).append("/").append(index).append("/").append(vulnType)
				.append("/").append(UNDERSCORE_COUNT);
		StringBuilder requestBody = new StringBuilder(
				"{\"query\":{\"bool\":{\"must\":[{\"match\":{\"latest\":\"true\"}}");
		if (vulnType.equals(EC2)) {
			requestBody.append(",{\"match\":{\"statename\":\"running\"}}");
		}
		requestBody.append("]}}}");

		try {
			String responseDetails = PacHttpUtils.doHttpPost(urlToQuery.toString(), requestBody.toString());
			JsonObject responseObj = (JsonObject) new JsonParser().parse(responseDetails);
			return responseObj.get("count").getAsLong();
		} catch (Exception e) {
			LOGGER.error("Error in getRunningInstancesCount", e);
			throw new DataException(e);
		}
	}

}