Storing a script

Hi guys,

I've been trying to save a script following the guideline Ive found in here: https://www.elastic.co/guide/en/elasticsearch/reference/master/modules-scripting-using.html#_request_examples

My request would be:

POST _scripts/func_test
{
  "script": {
    "lang": "painless",
    "code": "10 + params.my_modifier"
  }
}

As a response, I'm getting:

{
   "error": {
      "root_cause": [
         {
            "type": "illegal_argument_exception",
            "reason": "request [/_scripts/func_test] contains unrecognized parameter: [lang]"
         }
      ],
      "type": "illegal_argument_exception",
      "reason": "request [/_scripts/func_test] contains unrecognized parameter: [lang]"
   },
   "status": 400
}

Removing the "lang" param didn't help.

May guys tell me what I'm missing out here?

Cheeers

What version are you on?

That example is working for me on 5.4

As turns out, there is a syntax difference between 5.2.2 and 5.4...

I was comparing the pages now.

@Mark_Harwood, I use NETS .Net to create Elastic commands.
Do you know where can I find this command?

Thanks