mirror of
https://github.com/elastic/elasticsearch.git
synced 2025-06-28 17:34:17 -04:00
cutover some docs to painless
This commit is contained in:
parent
0b2baa7f63
commit
6fc1a22977
49 changed files with 1451 additions and 1149 deletions
|
@ -8,20 +8,20 @@ and delete indexed scripts and templates.
|
|||
[source,java]
|
||||
--------------------------------------------------
|
||||
PutIndexedScriptResponse = client.preparePutIndexedScript()
|
||||
.setScriptLang("groovy")
|
||||
.setScriptLang("painless")
|
||||
.setId("script1")
|
||||
.setSource("script", "_score * doc['my_numeric_field'].value")
|
||||
.execute()
|
||||
.actionGet();
|
||||
|
||||
GetIndexedScriptResponse = client.prepareGetIndexedScript()
|
||||
.setScriptLang("groovy")
|
||||
.setScriptLang("painless")
|
||||
.setId("script1")
|
||||
.execute()
|
||||
.actionGet();
|
||||
|
||||
DeleteIndexedScriptResponse = client.prepareDeleteIndexedScript()
|
||||
.setScriptLang("groovy")
|
||||
.setScriptLang("painless")
|
||||
.setId("script1")
|
||||
.execute()
|
||||
.actionGet();
|
||||
|
@ -33,4 +33,4 @@ To store templates simply use "mustache" for the scriptLang.
|
|||
|
||||
The API allows one to set the language of the indexed script being
|
||||
interacted with. If one is not provided the default scripting language
|
||||
will be used.
|
||||
will be used.
|
||||
|
|
|
@ -12,11 +12,11 @@ QueryBuilder qb = scriptQuery(
|
|||
<1> inlined script
|
||||
|
||||
|
||||
If you have stored on each data node a script named `mygroovyscript.groovy` with:
|
||||
If you have stored on each data node a script named `myscript.painless` with:
|
||||
|
||||
[source,groovy]
|
||||
[source,js]
|
||||
--------------------------------------------------
|
||||
doc['num1'].value > param1
|
||||
doc['num1'].value > params.param1
|
||||
--------------------------------------------------
|
||||
|
||||
You can use it then with:
|
||||
|
@ -25,9 +25,9 @@ You can use it then with:
|
|||
--------------------------------------------------
|
||||
QueryBuilder qb = scriptQuery(
|
||||
new Script(
|
||||
"mygroovyscript", <1>
|
||||
"myscript", <1>
|
||||
ScriptType.FILE, <2>
|
||||
"groovy", <3>
|
||||
"painless", <3>
|
||||
ImmutableMap.of("param1", 5)) <4>
|
||||
);
|
||||
--------------------------------------------------
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue