How to write a multi-lined script in C# / Nest?

Hi all,

I am trying to write a statement like this but in Nest / C# object initializer syntax:

GET /_search
{
  "query": {
    "bool": {
      "filter": {
        "script": {
          "script": """
            double amount = doc['amount'].value;
            if (doc['type'].value == 'expense') {
              amount *= -1;
            }
            return amount < 10;
          """
        }
      }
    }
  }
}

There are no docs that describe how to set up a multi line script in C# / Nest, from what I've seen the docs only show a basic maths operation without going in to more detail.

If someone could translate the example in the code blocks above (first example in these docs), I would be most grateful.

Sorry to bump but I can't find any documentation anywhere or on StackOverflow.

In all honesty, the .NET documentation is a bit thin for Elastic and would love to see more C#/Nest implementations of all the examples in the docs.

Bumping again, sorry!

Surely there must be someone at Elastic who can give some actual documentation on how to use their own product with C#?!

This topic was automatically closed 28 days after the last reply. New replies are no longer allowed.