class ESManager implements Constants {

    @SuppressWarnings("unchecked")
    public static Map<String, Map<String, Map<String, Object>>> fetchCurrentCountStatsForAssetGroups(String date) {

        Map<String, Map<String, Map<String, Object>>> asgInfoList = new HashMap<>();
        try {
            ObjectMapper objMapper = new ObjectMapper();
            String payLoad = "{\"query\": { \"match\": { \"date\": \"" + date + "\"} }}";
            Response response = invokeAPI("GET", "assetgroup_stats/count_type/_search?size=10000", payLoad);
            String responseJson = EntityUtils.toString(response.getEntity());

            Map<String, Object> docMap = objMapper.readValue(responseJson, new TypeReference<Map<String, Object>>() {
            });
            List<Map<String, Object>> docs = (List<Map<String, Object>>) ((Map<String, Object>) docMap.get("hits"))
                    .get("hits");

            for (Map<String, Object> doc : docs) {
                Map<String, Object> _doc = (Map<String, Object>) doc.get("_source");

                Map<String, Map<String, Object>> typeInfo = asgInfoList.get(_doc.get("ag").toString());
                if (typeInfo == null) {
                    typeInfo = new HashMap<>();
                    asgInfoList.put(_doc.get("ag").toString(), typeInfo);
                }

                typeInfo.put(_doc.get("type").toString(), _doc);
                _doc.remove("ag");
                _doc.remove("type");

            }
        } catch (ParseException | IOException e) {
           LOGGER.error("Error in fetchCurrentCountStatsForAssetGroups" ,e );
        }
        return asgInfoList;
    }

}