Skip to content

Instantly share code, notes, and snippets.

@spati-java
Last active September 20, 2018 00:46
Show Gist options
  • Save spati-java/944c6af6cce8d7c09bd47157ab69a15d to your computer and use it in GitHub Desktop.
Save spati-java/944c6af6cce8d7c09bd47157ab69a15d to your computer and use it in GitHub Desktop.
private List<ProfileDocument> getSearchResult(SearchResponse response) {
SearchHit[] searchHit = response.getHits().getHits();
List<ProfileDocument> profileDocuments = new ArrayList<>();
if (searchHit.length > 0) {
Arrays.stream(searchHit)
.forEach(hit -> profileDocuments
.add(objectMapper
.convertValue(hit.getSourceAsMap(),
ProfileDocument.class))
);
}
return profileDocuments;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment