I'm not quite sure I understood your question.
If you want to print the result of your search query according to your example, it should be something like this:
SearchHit[] results = sr.getHits().getHits(); for(SearchHit hit : results){ String sourceAsString = hit.getSourceAsString(); if (sourceAsString != null) { Gson gson = new GsonBuilder().setDateFormat(dateFormat) .create(); System.out.println( gson.fromJson(sourceAsString, Firewall.class)); } }
I am using Gson to convert from a Json response to FireWall (POJO).
Hope this is what you were looking for.
source share