Skip to content

Instantly share code, notes, and snippets.

@spati-java
Last active September 20, 2018 00:46
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • 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