Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

6.x不能用native了 #3

Open
wfox111 opened this issue Jul 5, 2019 · 0 comments
Open

6.x不能用native了 #3

wfox111 opened this issue Jul 5, 2019 · 0 comments

Comments

@wfox111
Copy link

wfox111 commented Jul 5, 2019

public String getType() {
//return "demoPlugin"; // script name
return "myscript";
}

MyScriptEngine的compile也要做一点修改,params无法获取到参数,要使用SearchScript.Factory factory = (p, lookup) -> new SearchScript.LeafFactory(){...}的p来获取
查询时使用
"script_score": {
"script": {
"source": "demoPlugin",
"lang": "myscript",
"params": {
"field": "test",
"text": "1"
}
}
}
lang为getType的return值,source为插件名
6.1.3亲测可用,官方文档地址,可参考:
https://www.elastic.co/guide/en/elasticsearch/reference/6.0/modules-scripting-engine.html?nsukey=TC4GNoi7V8SGUZSDocHVHesIeUCTyhBXqud%2BLvKwpuJmmkljLok8itiwuQawSXefZ9Jpy09GCSbKtUBSmTNs6IZmoH9wYePp4zb6Mr1IoS6gopicq56c%2FhIsnXM4x3UAmj%2FklieHp%2FlnSv4iQTTGgeHr%2BO5Cvh0c7bXINcqWxuNMZhPnVzEM5otr8g9JfQRpFEZ0Rq20ffXo36Usc3Ki7Q%3D%3D

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant