- 获取脚本
GET _scripts/脚本_name
- 新建脚本
POST _scripts/test_script
{
"script": {
"lang": "painless",
//dotProduct es内置函数 params入参
"source": "if(doc['skuVector'].length==0 ){return _score;} double score=dotProduct(params.queryVector, 'skuVector')+_score; if(score<0){return 0} return score "
}
}
java 代码调用
Map<String, Object> paramsMap = new HashMap<>();
paramsMap.put("queryVector", ranks);
paramsMap.put("currentTime", System.