ES的索引别名
https://cloud.tencent.com/developer/article/1122840
随机评分
https://www.elastic.co/guide/cn/elasticsearch/guide/current/random-scoring.html
https://www.programcreek.com/java-api-examples/?api=org.elasticsearch.index.query.functionscore.ScoreFunctionBuilders
constantScoreQuery
https://blog.csdn.net/u010882234/article/details/119521714
if (CollectionUtils.isNotEmpty(itemIdList)) { itemIdList = itemIdList.stream().distinct().collect(Collectors.toList()); BoolQueryBuilder idBoolQueryBuilder = QueryBuilders.boolQuery(); idBoolQueryBuilder.mustNot(QueryBuilders.termsQuery(ItemSearch.ID, itemIdList)); // constant_score默认固定分数为1 ConstantScoreQueryBuilder constantScoreQueryBuilder = QueryBuilders.constantScoreQuery(idBoolQueryBuilder); FunctionScoreQueryBuilder functionScoreQueryBuilder = QueryBuilders.functionScoreQuery(constantScoreQueryBuilder, builders).scoreMode(FunctionScoreQuery.ScoreMode.SUM) .boostMode(CombineFunction.SUM); queryBuilder.withQuery(functionScoreQueryBuilder); }
这代码是有问题的,constantScoreQuery无法实现,满足条件,加常量1分,即不能作为
FunctionScoreQueryBuilder使用。并且,这里的 idBoolQueryBuilder,会过滤掉查询结果!
Java Examples for org.elasticsearch.index.query.ConstantScoreQueryBuilder
https://www.javatips.net/api/org.elasticsearch.index.query.constantscorequerybuilder
Elasticsearch--java操作之QueryBuilders构建搜索Query
https://blog.csdn.net/weixin_42650954/article/details/117921101
write scripts
https://www.elastic.co/guide/en/elasticsearch/reference/current/modules-scripting-using.html