NOTE: You are looking at documentation for an older release. For the latest information, see the current release documentation.
Script Query Usage
edit
IMPORTANT: This documentation is no longer updated. Refer to Elastic's version policy and the latest documentation.
Script Query Usage
editA query allowing to define scripts as queries.
See the Elasticsearch documentation on script query for more details.
Fluent DSL example
editq
.Script(sn => sn
.Name("named_query")
.Boost(1.1)
.Source(_templateString)
.Params(p => p.Add("param1", 50))
)
Object Initializer syntax example
editnew ScriptQuery
{
Name = "named_query",
Boost = 1.1,
Source = _templateString,
Params = new Dictionary<string, object>
{
{ "param1", 50 }
}
}
Example json output.
{
"script": {
"_name": "named_query",
"boost": 1.1,
"script": {
"source": "doc['numberOfCommits'].value > params.param1",
"params": {
"param1": 50
}
}
}
}