WARNING: Version 5.x has passed its EOL date.
This documentation is no longer being maintained and may be removed. If you are running this version, we strongly advise you to upgrade. For the latest information, see the current release documentation.
Script Query Usageedit
A query allowing to define scripts as queries.
See the Elasticsearch documentation on script query for more details.
Fluent DSL exampleedit
q .Script(sn => sn .Name("named_query") .Boost(1.1) .Inline(_templateString) .Params(p => p.Add("param1", 50)) )
Object Initializer syntax exampleedit
new ScriptQuery { Name = "named_query", Boost = 1.1, Inline = _templateString, Params = new Dictionary<string, object> { { "param1", 50 } } }
Example json output.
{ "script": { "_name": "named_query", "boost": 1.1, "script": { "inline": "doc['numberOfCommits'].value > param1", "params": { "param1": 50 } } } }