POJO列表中的弹性搜索结果
目前,我将弹性搜索命中率映射到POJO,然后重申其保存在列表中。
List<Content> contentList = new ArrayList<>();
final BoolQueryBuilder qb = QueryBuilders.boolQuery()
.must(QueryBuilders.termQuery("tenantId","yes"));
SearchHits<Content> hits = elasticsearchTemplate.search(new NativeSearchQuery(qb), Content.class,IndexCoordinates.of("preview"));
contentList = hits.stream().map(SearchHit::getContent).collect(Collectors.toList());
有什么方法可以将弹性结果直接映射到content pojo列表中,并从搜索hit中迭代它。
Currently, I am mapping the elastic search hit to a POJO and then reiterating it to save in a list.
List<Content> contentList = new ArrayList<>();
final BoolQueryBuilder qb = QueryBuilders.boolQuery()
.must(QueryBuilders.termQuery("tenantId","yes"));
SearchHits<Content> hits = elasticsearchTemplate.search(new NativeSearchQuery(qb), Content.class,IndexCoordinates.of("preview"));
contentList = hits.stream().map(SearchHit::getContent).collect(Collectors.toList());
Is there a way i can directly map the elastic result to List of Content POJO with out iterating it from Search Hit.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
您可以使用以下内容:
You can use the following: