Script Query Usage

edit

A query allowing to define scripts as queries.

See the Elasticsearch documentation on script query for more details.

Fluent DSL example

edit
q
.Script(sn => sn
    .Name("named_query")
    .Inline(_templateString)
    .Params(p => p.Add("param1", 50))
)

Object Initializer syntax example

edit
new ScriptQuery
{
    Name = "named_query",
    Inline = _templateString,
    Params = new Dictionary<string, object>
    {
        { "param1", 50 }
    }
}

Example json output.

{
  "script": {
    "_name": "named_query",
    "script": {
      "inline": "doc['numberOfCommits'].value > param1",
      "params": {
        "param1": 50
      }
    }
  }
}