class FAQRespositoryImpl implements FAQRepository, Constants {

    @Override
    public List<Map<String, Object>> getRelevantFAQSFromEs(String widgetId,
            String domainId, List<String> tag, List<String> faqid,
            List<Map<String, Object>> releventfaqs) throws DataException {
        // Get All FAQ's assigned to to this widgetId from ES.
        JsonParser jsonParser = new JsonParser();
        StringBuilder urlToQueryBuffer = new StringBuilder(esUrl).append("/")
                .append("faqs/faqinfo").append("/").append("_search");
        StringBuilder requestFaqBody = new StringBuilder(
                "{\"_source\":[\"faqname\",\"answer\"],\"query\":{\"bool\":{\"must\":[{\"terms\":{\"tag.keyword\":"
                        + tag
                        + "}},{\"match\":{\"domainid.keyword\":\""
                        + domainId
                        + "\"}}],\"must_not\":[{\"terms\":{\"faqid.keyword\":"
                        + faqid + "}}]}}}");
        String responseFaqJson ;
       try{
           responseFaqJson= PacHttpUtils.doHttpPost(

                urlToQueryBuffer.toString(), requestFaqBody.toString());
       }catch(Exception e){
           throw new DataException(e);
       }
        JsonObject resultFaqJson = (JsonObject) jsonParser
                .parse(responseFaqJson);
        JsonObject hitsFaq = (JsonObject) resultFaqJson.get("hits");
        JsonArray jsonArrayFaq = hitsFaq.get("hits").getAsJsonArray();
        for (int j = 0; j < jsonArrayFaq.size(); j++) {
            JsonObject sourceFaq = (JsonObject) jsonArrayFaq.get(j)
                    .getAsJsonObject().get("_source");
            ConcurrentHashMap<String, Object> relectfaqDetails = new ConcurrentHashMap<>();
            relectfaqDetails.put("faqName", sourceFaq.get("faqname")
                    .getAsString());
            relectfaqDetails.put("faqAnswer", sourceFaq.get("answer")
                    .getAsString());
            releventfaqs.add(relectfaqDetails);

        }
        return releventfaqs;
    }

}