How to convert the below ES query to Java API? I am using elastic search 2.3.3
GET /schema_name/_search
{
\"from\": 0,
\"size\": 200,
\"query\": {
\"functi
Achieved it as below using the 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()))));
}
}