常用 elasticsearch 查询 及 java 实现
2021-01-26 22:13
标签:this java index tor like elastic key highlight color collopse 常用 elasticsearch 查询 及 java 实现 标签:this java index tor like elastic key highlight color 原文地址:https://www.cnblogs.com/merseyalma/p/12851901.html{
"size":3,
"query":{
"more_like_this":{
"fields" : ["remark"],
"like" : ["特价","套装" ],
"min_term_freq" : 1,
"max_query_terms" : 1
}
} ,
"collapse" : {
"field" : "userid.keyword"
},
"_source":["userid"],
"sort": {
"time": "asc"
}
}
SearchSourceBuilder sourceBuilder = new SearchSourceBuilder();
sourceBuilder.query(query);
sourceBuilder.collapse(new CollapseBuilder("userid.keyword"));
sourceBuilder.from(pagesize * pageindex);
sourceBuilder.size(pagesize);
sourceBuilder.fetchSource(new String[] { "userid" }, new String[] {});
sourceBuilder.sort("time", SortOrder.DESC);
文章标题:常用 elasticsearch 查询 及 java 实现
文章链接:http://soscw.com/index.php/essay/47459.html