使用Java API如下实现
FunctionScoreQueryBuilder functionScoreQueryBuilder = QueryBuilders .functionScoreQuery(queryBuilder) .setMinScore(0f) .maxBoost(50f) .scoreMode("max") .boostMode(CombineFunction.REPLACE); for (String alertCode : ruleCodesLowerCase) { if(alertPriorityMap.get(alertCode.toUpperCase()) != null){ functionScoreQueryBuilder.add(QueryBuilders.termQuery(alertESEnum.alert_CODE_FIELD.value(), alertCode), ScoreFunctionBuilders.weightFactorFunction((alertPriority.intValue(alertPriorityMap.get(alertCode.toUpperCase()).getPriority())))); } }
欢迎分享,转载请注明来源:内存溢出
评论列表(0条)