Term Aggregation on float_range fields


(David Shi) #1

Hello, running in to some trouble trying to perform aggregation on a float_range field. I have a field NUM_AGE which is of type float_range as specified in my mapping, which I would like to get all the unique values for. I've included the query and the error output, is this supported, and/or is there any workarounds?

Query:

GET toys/product/_search
{
  "size": 0,
  "aggregations": {
    "my_agg": {
      "terms": {
        "field": "NUM_AGE"
      }
    }
  }
}

Output:

{
  "error": {
    "root_cause": [
      {
        "type": "illegal_argument_exception",
        "reason": "Fielddata is not supported on field [NUM_AGE] of type [float_range]"
      }
    ],
    "type": "search_phase_execution_exception",
    "reason": "all shards failed",
    "phase": "query",
    "grouped": true,
    "failed_shards": [
      {
        "shard": 0,
        "index": "toys",
        "node": "4rl9CsFoTEKt9JSnRT49Tg",
        "reason": {
          "type": "illegal_argument_exception",
          "reason": "Fielddata is not supported on field [NUM_AGE] of type [float_range]"
        }
      }
    ]
  },
  "status": 400
}

Cheers,

DS


(system) #2

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