throw new QueryParsingException(parseContext.index(), "[custom_score] requires 'script' field");
}
SearchContext context = SearchContext.current();
if (context == null) {
throw new ElasticSearchIllegalStateException("No search context on going...");
}
SearchScript searchScript = context.scriptService().search(context.lookup(), scriptLang, script, vars);
FunctionScoreQuery functionScoreQuery = new FunctionScoreQuery(query, new ScriptScoreFunction(searchScript));
functionScoreQuery.setBoost(boost);
return functionScoreQuery;