Skip to content

Instantly share code, notes, and snippets.

@garystafford
Created September 18, 2018 01:18
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 garystafford/34876ac0bc37b573c93fc6e2a073d031 to your computer and use it in GitHub Desktop.
Save garystafford/34876ac0bc37b573c93fc6e2a073d031 to your computer and use it in GitHub Desktop.
@RequestMapping(value = "/{id}")
@ApiOperation(value = "Returns a post by id")
public Map<String, Optional<ElasticsearchPost>> findById(@PathVariable("id") long id) {
Optional<ElasticsearchPost> elasticsearchPost = elasticsearchPostRepository.findById(id);
Map<String, Optional<ElasticsearchPost>> elasticsearchPostMap = new HashMap<>();
elasticsearchPostMap.put("ElasticsearchPosts", elasticsearchPost);
return elasticsearchPostMap;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment