class PatchingRepositoryImpl implements PatchingRepository, Constants {

    public List<Map<String, Object>> getClosedIssueInfo(String assetGroup,
            int size) throws DataException {
        /* query has exist field genric ES queries will not support */
        String responseJson = null;
        List<Map<String, Object>> issueDetails = null;
        List<Map<String, Object>> closedLissues = new ArrayList<>();

        Gson serializer = new GsonBuilder().create();
        StringBuilder requestBody = new StringBuilder(
                "{\"size\":\""
                        + size
                        + "\",\"_source\":[\"_resourceid\",\"reason-to-close\"],\"sort\":[{\"closeddate\":{\"order\":\"desc\"}}],\"query\":{\"bool\":{\"must\":[{\"match\":{\"issueStatus.keyword\":\"closed\"}},{\"match\":{\"ruleId.keyword\":\""
                        + EC2_KERNEL_COMPLIANCE_RULE
                        + "\"}},{\"exists\":{\"field\":\"reason-to-close\"}}],\"must_not\":[{\"match\":{\"reason-to-close.keyword\":\"Rule evaluation sucessfull\"}},{\"match\":{\"reason-to-close.keyword\":\"resource not found\"}}]}}}");
        StringBuilder urlToQueryBuffer = new StringBuilder(esUrl).append("/")
                .append(assetGroup).append("/").append(SEARCH);
        try{
        responseJson = PacHttpUtils.doHttpPost(urlToQueryBuffer.toString(),
                requestBody.toString());
        } catch(Exception e){
            throw new DataException(e);
        }
        Map<String, Object> responseMap = (Map<String, Object>) serializer
                .fromJson(responseJson, Object.class);
        if (responseMap.containsKey("hits")) {
            Map<String, Object> hits = (Map<String, Object>) responseMap
                    .get("hits");
            if (hits.containsKey("hits")) {
                issueDetails = (List<Map<String, Object>>) hits.get("hits");
                for (Map<String, Object> issueDetail : issueDetails) {
                    Map<String, Object> sourceMap = (Map<String, Object>) issueDetail
                            .get("_source");
                    closedLissues.add(sourceMap);
                }
            }
        }
        return closedLissues;
    }

}