private List<String> extractIds(SearchResponse response) { List<String> ids = new ArrayList<String>(); for (SearchHit hit : response.getHits()) { if (hit != null) { ids.add(hit.getId()); } } return ids; }