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; }
private static String[] toArray(List<String> values) { String[] valuesAsArray = new String[values.size()]; return values.toArray(valuesAsArray); }