FiftiN
FiftiN

Reputation: 797

No matching token for number_type [BIG_INTEGER] when trying to save large number as float

I have next dynamic template for type:

    "dynamic_templates" : [
      {
        "$r_as_float" : {
          "match" : "*$r",
          "mapping" : {
            "type" : "float"
          }
        }
      }
    ]

When I try to create new document:

curl -XPOST es-1:9200/mydataspace_001001/type/276121/_create -d '
{
  "kbk$r": 17404121130190019244,
}

I receive next error:

{"type":"illegal_state_exception","reason":"No matching token for number_type [BIG_INTEGER]"}

I have no this error when "kbk$r": 17404 for example.

Upvotes: 1

Views: 1644

Answers (1)

Val
Val

Reputation: 217474

A float can only take a single-precision 32-bit IEEE 754 floating point and 17404121130190019244 is way over that limit.

You need to either use a double or a longtype instead of float. See the different numeric types at your disposal.

Upvotes: 2

Related Questions