{
  "comment" : "This is generated by ESQL's AbstractFunctionTestCase. Do not edit it. See ../README.md for how to regenerate it.",
  "type" : "agg",
  "name" : "top",
  "description" : "Collects the top values for a field. Includes repeated values.",
  "signatures" : [
    {
      "params" : [
        {
          "name" : "field",
          "type" : "boolean",
          "optional" : false,
          "description" : "The field to collect the top values for."
        },
        {
          "name" : "limit",
          "type" : "integer",
          "optional" : false,
          "description" : "The maximum number of values to collect."
        },
        {
          "name" : "order",
          "type" : "keyword",
          "optional" : false,
          "description" : "The order to calculate the top values. Either `asc` or `desc`."
        }
      ],
      "variadic" : false,
      "returnType" : "boolean"
    },
    {
      "params" : [
        {
          "name" : "field",
          "type" : "date",
          "optional" : false,
          "description" : "The field to collect the top values for."
        },
        {
          "name" : "limit",
          "type" : "integer",
          "optional" : false,
          "description" : "The maximum number of values to collect."
        },
        {
          "name" : "order",
          "type" : "keyword",
          "optional" : false,
          "description" : "The order to calculate the top values. Either `asc` or `desc`."
        }
      ],
      "variadic" : false,
      "returnType" : "date"
    },
    {
      "params" : [
        {
          "name" : "field",
          "type" : "double",
          "optional" : false,
          "description" : "The field to collect the top values for."
        },
        {
          "name" : "limit",
          "type" : "integer",
          "optional" : false,
          "description" : "The maximum number of values to collect."
        },
        {
          "name" : "order",
          "type" : "keyword",
          "optional" : false,
          "description" : "The order to calculate the top values. Either `asc` or `desc`."
        }
      ],
      "variadic" : false,
      "returnType" : "double"
    },
    {
      "params" : [
        {
          "name" : "field",
          "type" : "integer",
          "optional" : false,
          "description" : "The field to collect the top values for."
        },
        {
          "name" : "limit",
          "type" : "integer",
          "optional" : false,
          "description" : "The maximum number of values to collect."
        },
        {
          "name" : "order",
          "type" : "keyword",
          "optional" : false,
          "description" : "The order to calculate the top values. Either `asc` or `desc`."
        }
      ],
      "variadic" : false,
      "returnType" : "integer"
    },
    {
      "params" : [
        {
          "name" : "field",
          "type" : "ip",
          "optional" : false,
          "description" : "The field to collect the top values for."
        },
        {
          "name" : "limit",
          "type" : "integer",
          "optional" : false,
          "description" : "The maximum number of values to collect."
        },
        {
          "name" : "order",
          "type" : "keyword",
          "optional" : false,
          "description" : "The order to calculate the top values. Either `asc` or `desc`."
        }
      ],
      "variadic" : false,
      "returnType" : "ip"
    },
    {
      "params" : [
        {
          "name" : "field",
          "type" : "keyword",
          "optional" : false,
          "description" : "The field to collect the top values for."
        },
        {
          "name" : "limit",
          "type" : "integer",
          "optional" : false,
          "description" : "The maximum number of values to collect."
        },
        {
          "name" : "order",
          "type" : "keyword",
          "optional" : false,
          "description" : "The order to calculate the top values. Either `asc` or `desc`."
        }
      ],
      "variadic" : false,
      "returnType" : "keyword"
    },
    {
      "params" : [
        {
          "name" : "field",
          "type" : "long",
          "optional" : false,
          "description" : "The field to collect the top values for."
        },
        {
          "name" : "limit",
          "type" : "integer",
          "optional" : false,
          "description" : "The maximum number of values to collect."
        },
        {
          "name" : "order",
          "type" : "keyword",
          "optional" : false,
          "description" : "The order to calculate the top values. Either `asc` or `desc`."
        }
      ],
      "variadic" : false,
      "returnType" : "long"
    },
    {
      "params" : [
        {
          "name" : "field",
          "type" : "text",
          "optional" : false,
          "description" : "The field to collect the top values for."
        },
        {
          "name" : "limit",
          "type" : "integer",
          "optional" : false,
          "description" : "The maximum number of values to collect."
        },
        {
          "name" : "order",
          "type" : "keyword",
          "optional" : false,
          "description" : "The order to calculate the top values. Either `asc` or `desc`."
        }
      ],
      "variadic" : false,
      "returnType" : "keyword"
    }
  ],
  "examples" : [
    "FROM employees\n| STATS top_salaries = TOP(salary, 3, \"desc\"), top_salary = MAX(salary)"
  ],
  "preview" : false,
  "snapshot_only" : false
}
