Skip to content

Indexing a value of "1.0" to byte field with coerce=true fails on 5.5.0 #25819

@PaulieMac

Description

@PaulieMac

Elasticsearch version:
"version" : {
"number" : "5.5.0",
"build_hash" : "260387d",
"build_date" : "2017-06-30T23:16:05.735Z",
"build_snapshot" : false,
"lucene_version" : "6.6.0"
}

Plugins installed: none

JVM version (java -version):
java version "1.8.0_131"
Java(TM) SE Runtime Environment (build 1.8.0_131-b11)
Java HotSpot(TM) 64-Bit Server VM (build 25.131-b11, mixed mode)

OS version
DISTRIB_ID=Ubuntu
DISTRIB_RELEASE=14.04
DISTRIB_CODENAME=trusty
DISTRIB_DESCRIPTION="Ubuntu 14.04.5 LTS"

Description of the problem including expected versus actual behavior:

Attempting to index a value of "1.0" to byte field mapped with coerce=true fails with the following error: number_format_exception

Steps to reproduce:

curl -X PUT localhost:9200/testing -d '{ "mappings" : { "coerceme" : { "properties" : { "test" : { "type" : "byte", "coerce" : true}}}}}'

curl -X PUT localhost:9200/testing/coerceme/1 -d '{ "test" : "1.0" }'

Response:
{"error":{"root_cause":[{"type":"mapper_parsing_exception","reason":"failed to parse [test]"}],"type":"mapper_parsing_exception","reason":"failed to parse [test]","caused_by":{"type":"number_format_exception","reason":"For input string: "1.0""}},"status":400}

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions