Groovy Scripting optional paramters

I'm trying to figure out how to have optional params with default value.

My script is simple:

{
  "script": "doc[field].empty ? 0 : (201 - doc[field]) * boost"
}

I want the boost to default to 1 if its omitted in the call.

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