| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657 | [[query-dsl-script-query]]=== Script QueryA query allowing to define<<modules-scripting,scripts>> as queries. They are typically used in a filtercontext, for example:[source,js]----------------------------------------------GET /_search{    "query": {        "bool" : {            "must" : {                "script" : {                    "script" : {                        "inline": "doc['num1'].value > 1",                        "lang": "painless"                     }                }            }        }    }}----------------------------------------------// CONSOLE[float]==== Custom ParametersScripts are compiled and cached for faster execution. If the same scriptcan be used, just with different parameters provider, it is preferableto use the ability to pass parameters to the script itself, for example:[source,js]----------------------------------------------GET /_search{    "query": {        "bool" : {            "must" : {                "script" : {                    "script" : {                        "inline" : "doc['num1'].value > params.param1",                        "lang"   : "painless",                        "params" : {                            "param1" : 5                        }                    }                }            }        }    }}----------------------------------------------// CONSOLE
 |