30 lines
954 B
Plaintext
30 lines
954 B
Plaintext
[[java-query-dsl-script-query]]
|
|
==== Script Query
|
|
|
|
See {ref}/query-dsl-script-query.html[Script Query]
|
|
|
|
["source","java",subs="attributes,callouts,macros"]
|
|
--------------------------------------------------
|
|
include-tagged::{query-dsl-test}[script_inline]
|
|
--------------------------------------------------
|
|
<1> inlined script
|
|
|
|
|
|
If you have stored on each data node a script named `myscript.painless` with:
|
|
|
|
[source,painless]
|
|
--------------------------------------------------
|
|
doc['num1'].value > params.param1
|
|
--------------------------------------------------
|
|
|
|
You can use it then with:
|
|
|
|
["source","java",subs="attributes,callouts,macros"]
|
|
--------------------------------------------------
|
|
include-tagged::{query-dsl-test}[script_file]
|
|
--------------------------------------------------
|
|
<1> Script type: either `ScriptType.FILE`, `ScriptType.INLINE` or `ScriptType.INDEXED`
|
|
<2> Scripting engine
|
|
<3> Script name
|
|
<4> Parameters as a `Map<String, Object>`
|