{
  "comment" : "This is generated by ESQL's AbstractFunctionTestCase. Do not edit it. See ../README.md for how to regenerate it.",
  "type" : "scalar",
  "name" : "decay",
  "description" : "Calculates a relevance score that decays based on the distance of a numeric, spatial or date type value from a target origin, using configurable decay functions.",
  "signatures" : [
    {
      "params" : [
        {
          "name" : "value",
          "type" : "cartesian_point",
          "optional" : false,
          "description" : "The input value to apply decay scoring to."
        },
        {
          "name" : "origin",
          "type" : "cartesian_point",
          "optional" : false,
          "description" : "Central point from which the distances are calculated."
        },
        {
          "name" : "scale",
          "type" : "double",
          "optional" : false,
          "description" : "Distance from the origin where the function returns the decay value."
        },
        {
          "name" : "options",
          "type" : "function_named_parameters",
          "mapParams" : "{name='offset', values=[], description='Distance from the origin where no decay occurs.', type=[double, integer, long, time_duration, keyword, text]}, {name='type', values=[], description='Decay function to use: linear, exponential or gaussian.', type=[keyword]}, {name='decay', values=[], description='Multiplier value returned at the scale distance from the origin.', type=[double]}",
          "optional" : true,
          "description" : ""
        }
      ],
      "variadic" : false,
      "returnType" : "double"
    },
    {
      "params" : [
        {
          "name" : "value",
          "type" : "date",
          "optional" : false,
          "description" : "The input value to apply decay scoring to."
        },
        {
          "name" : "origin",
          "type" : "date",
          "optional" : false,
          "description" : "Central point from which the distances are calculated."
        },
        {
          "name" : "scale",
          "type" : "time_duration",
          "optional" : false,
          "description" : "Distance from the origin where the function returns the decay value."
        },
        {
          "name" : "options",
          "type" : "function_named_parameters",
          "mapParams" : "{name='offset', values=[], description='Distance from the origin where no decay occurs.', type=[double, integer, long, time_duration, keyword, text]}, {name='type', values=[], description='Decay function to use: linear, exponential or gaussian.', type=[keyword]}, {name='decay', values=[], description='Multiplier value returned at the scale distance from the origin.', type=[double]}",
          "optional" : true,
          "description" : ""
        }
      ],
      "variadic" : false,
      "returnType" : "double"
    },
    {
      "params" : [
        {
          "name" : "value",
          "type" : "date_nanos",
          "optional" : false,
          "description" : "The input value to apply decay scoring to."
        },
        {
          "name" : "origin",
          "type" : "date_nanos",
          "optional" : false,
          "description" : "Central point from which the distances are calculated."
        },
        {
          "name" : "scale",
          "type" : "time_duration",
          "optional" : false,
          "description" : "Distance from the origin where the function returns the decay value."
        },
        {
          "name" : "options",
          "type" : "function_named_parameters",
          "mapParams" : "{name='offset', values=[], description='Distance from the origin where no decay occurs.', type=[double, integer, long, time_duration, keyword, text]}, {name='type', values=[], description='Decay function to use: linear, exponential or gaussian.', type=[keyword]}, {name='decay', values=[], description='Multiplier value returned at the scale distance from the origin.', type=[double]}",
          "optional" : true,
          "description" : ""
        }
      ],
      "variadic" : false,
      "returnType" : "double"
    },
    {
      "params" : [
        {
          "name" : "value",
          "type" : "double",
          "optional" : false,
          "description" : "The input value to apply decay scoring to."
        },
        {
          "name" : "origin",
          "type" : "double",
          "optional" : false,
          "description" : "Central point from which the distances are calculated."
        },
        {
          "name" : "scale",
          "type" : "double",
          "optional" : false,
          "description" : "Distance from the origin where the function returns the decay value."
        },
        {
          "name" : "options",
          "type" : "function_named_parameters",
          "mapParams" : "{name='offset', values=[], description='Distance from the origin where no decay occurs.', type=[double, integer, long, time_duration, keyword, text]}, {name='type', values=[], description='Decay function to use: linear, exponential or gaussian.', type=[keyword]}, {name='decay', values=[], description='Multiplier value returned at the scale distance from the origin.', type=[double]}",
          "optional" : true,
          "description" : ""
        }
      ],
      "variadic" : false,
      "returnType" : "double"
    },
    {
      "params" : [
        {
          "name" : "value",
          "type" : "geo_point",
          "optional" : false,
          "description" : "The input value to apply decay scoring to."
        },
        {
          "name" : "origin",
          "type" : "geo_point",
          "optional" : false,
          "description" : "Central point from which the distances are calculated."
        },
        {
          "name" : "scale",
          "type" : "keyword",
          "optional" : false,
          "description" : "Distance from the origin where the function returns the decay value."
        },
        {
          "name" : "options",
          "type" : "function_named_parameters",
          "mapParams" : "{name='offset', values=[], description='Distance from the origin where no decay occurs.', type=[double, integer, long, time_duration, keyword, text]}, {name='type', values=[], description='Decay function to use: linear, exponential or gaussian.', type=[keyword]}, {name='decay', values=[], description='Multiplier value returned at the scale distance from the origin.', type=[double]}",
          "optional" : true,
          "description" : ""
        }
      ],
      "variadic" : false,
      "returnType" : "double"
    },
    {
      "params" : [
        {
          "name" : "value",
          "type" : "geo_point",
          "optional" : false,
          "description" : "The input value to apply decay scoring to."
        },
        {
          "name" : "origin",
          "type" : "geo_point",
          "optional" : false,
          "description" : "Central point from which the distances are calculated."
        },
        {
          "name" : "scale",
          "type" : "text",
          "optional" : false,
          "description" : "Distance from the origin where the function returns the decay value."
        },
        {
          "name" : "options",
          "type" : "function_named_parameters",
          "mapParams" : "{name='offset', values=[], description='Distance from the origin where no decay occurs.', type=[double, integer, long, time_duration, keyword, text]}, {name='type', values=[], description='Decay function to use: linear, exponential or gaussian.', type=[keyword]}, {name='decay', values=[], description='Multiplier value returned at the scale distance from the origin.', type=[double]}",
          "optional" : true,
          "description" : ""
        }
      ],
      "variadic" : false,
      "returnType" : "double"
    },
    {
      "params" : [
        {
          "name" : "value",
          "type" : "integer",
          "optional" : false,
          "description" : "The input value to apply decay scoring to."
        },
        {
          "name" : "origin",
          "type" : "integer",
          "optional" : false,
          "description" : "Central point from which the distances are calculated."
        },
        {
          "name" : "scale",
          "type" : "integer",
          "optional" : false,
          "description" : "Distance from the origin where the function returns the decay value."
        },
        {
          "name" : "options",
          "type" : "function_named_parameters",
          "mapParams" : "{name='offset', values=[], description='Distance from the origin where no decay occurs.', type=[double, integer, long, time_duration, keyword, text]}, {name='type', values=[], description='Decay function to use: linear, exponential or gaussian.', type=[keyword]}, {name='decay', values=[], description='Multiplier value returned at the scale distance from the origin.', type=[double]}",
          "optional" : true,
          "description" : ""
        }
      ],
      "variadic" : false,
      "returnType" : "double"
    },
    {
      "params" : [
        {
          "name" : "value",
          "type" : "long",
          "optional" : false,
          "description" : "The input value to apply decay scoring to."
        },
        {
          "name" : "origin",
          "type" : "long",
          "optional" : false,
          "description" : "Central point from which the distances are calculated."
        },
        {
          "name" : "scale",
          "type" : "long",
          "optional" : false,
          "description" : "Distance from the origin where the function returns the decay value."
        },
        {
          "name" : "options",
          "type" : "function_named_parameters",
          "mapParams" : "{name='offset', values=[], description='Distance from the origin where no decay occurs.', type=[double, integer, long, time_duration, keyword, text]}, {name='type', values=[], description='Decay function to use: linear, exponential or gaussian.', type=[keyword]}, {name='decay', values=[], description='Multiplier value returned at the scale distance from the origin.', type=[double]}",
          "optional" : true,
          "description" : ""
        }
      ],
      "variadic" : false,
      "returnType" : "double"
    }
  ],
  "examples" : [
    "FROM employees\n| EVAL decay_result = decay(salary, 0, 100000, {\"offset\": 5, \"decay\": 0.5, \"type\": \"linear\"})\n| SORT decay_result DESC"
  ],
  "preview" : true,
  "snapshot_only" : false
}
