有个人长的像洋葱,走着走着就哭了…….

elsticsearch的java代码如何设置多个字段的高亮

Elasticsearch | 作者 qqq1234567 | 发布于2018年10月19日 | 阅读数:7129

系统提示:这个人太懒了,什么问题描述都没有写!

已邀请:

rochy - rochy_he

赞同来自: Merrizee

SearchSourceBuilder searchSourceBuilder = new SearchSourceBuilder();
HighlightBuilder highlightBuilder = new HighlightBuilder();
HighlightBuilder.Field highlightTitle =
new HighlightBuilder.Field("title");
highlightTitle.highlighterType("unified");
highlightBuilder.field(highlightTitle);
HighlightBuilder.Field highlightUser = new HighlightBuilder.Field("user");
highlightBuilder.field(highlightUser);
searchSourceBuilder.highlighter(highlightBuilder);

 具体可以参看:https://www.elastic.co/guide/e ... hting

要回复问题请先登录注册