Skip to content

scaled_float are used as longs in aggregations #22350

@jimczi

Description

@jimczi

Originated from elastic/kibana#9568

For scaled_float type the expectation is that aggregations works on the scaled float value. For instance for the value "6.98" with a scaling factor of 10 the bucket "6.9" should be used.
Currently the aggregations use the long value of the scaled float to compute the buckets. So instead of "6.9" the created bucket is "6".

Steps to reproduce:

PUT t 
{
   "mappings": {
      "t": {
         "properties": {
            "ctMultiplier": {
               "scaling_factor": 10,
               "type": "scaled_float",
               "store": true
            }
         }
      }
   }
}

POST t/t/1
{
    "ctMultiplier": "6.8"
}

POST t/t/2
{
    "ctMultiplier": "6.9"
}


GET _search
{
    "size": 0,
    "aggs": {
        "t": {
            "terms": {
                "field": "ctMultiplier"
            }
        }
    }
}

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions