class VulnerabilityRepository implements Constants {

	public List<Map<String, Object>> getAllVulnerabilitiesByAssetGroup(String assetGroup, String targetType,
			Map<String, Object> mustFilter, List<String> occurrenceFieldList, int from, int size,
			Map<String, Object> mustTermsFilter) throws DataException {
		List<Map<String, Object>> results = new ArrayList<>();
		if (size != 0) {
			try {
				results = elasticSearchRepository.getSortedDataFromESBySize(assetGroup, targetType, mustFilter, null,
						null, occurrenceFieldList, from, size, null, mustTermsFilter, null);
			} catch (Exception e) {
				LOGGER.error("Error in getAllVulnerabilitiesByAssetGroup", e);
				throw new DataException();
			}
		} else {
			try {
				/*
				 * results = vulnerabilityAssetsCount(assetGroup, targetType, mustFilter,
				 * occurrenceFieldList, from, size);
				 */
				results = elasticSearchRepository.getSortedDataFromES(assetGroup, targetType, mustFilter, null, null,
						occurrenceFieldList, mustTermsFilter, null);
			} catch (Exception e) {
				LOGGER.error("Error in getAllVulnerabilitiesByAssetGroup", e);
				throw new DataException();
			}

		}
		for (Map<String, Object> map : results) {
			map.remove("_routing");
			map.remove("_parent");
			map.remove("_id");
		}
		return results;
	}

}