Sounds like a bug. If I had to guess I'd say Elasticsearch is rounding the type up to support unsigned bytes and not doing the range check but I haven't looked.
Nik On Wed, Dec 3, 2014 at 9:34 AM, Damien Montigny <damien.monti...@gmail.com> wrote: > Anyone ? > > Le jeudi 20 novembre 2014 16:27:44 UTC+1, Damien Montigny a écrit : > >> Hi everyone, >> >> If was experimenting on mappings for index size optimization purpose and >> I have an issue, it seems a bug to me, I cannot find any documentaion about >> it. >> >> When I declare a field of type *byte *ES seems to be considering it as >> *short*, for proof see the error message of the last curl below, it >> mentions the short type even though I declared a byte >> (*MapperParsingException[failed to parse [some_data]]; nested: >> JsonParseException[Numeric value (32768) out of range of Java short*) >> >> *Every has been tested on a freshly untared ES.* >> >> *# Create the index* >> curl -XPUT 'http://localhost:9200/some_index?pretty' -d ' >> { >> "mappings": { >> "some_type": { >> "dynamic": "strict", >> "properties": { >> "some_data": { >> "type": "byte" >> } >> } >> } >> } >> } >> ' >> >> *# Insert a doc with a value just out of the range of the byte type, >> success, wierd* >> curl -XPUT "http://localhost:9200/some_index/some_type/1?pretty" -d ' >> { >> "some_data": 256 >> } >> ' >> >> *# Insert a doc with the max value for the short type, success, still >> wierd* >> curl -XPUT "http://localhost:9200/some_index/some_type/1?pretty" -d ' >> { >> "some_data": 32767 >> } >> ' >> >> *# Insert a doc with a value just out of the range of the short type, >> failure, ok I get it, ES sees it as a short...* >> curl -XPUT "http://localhost:9200/some_index/some_type/1?pretty" -d ' >> { >> "some_data": 32768 >> } >> ' >> >> *java -version* outputs : >> java version "1.7.0_07" >> Java(TM) SE Runtime Environment (build 1.7.0_07-b10) >> Java HotSpot(TM) 64-Bit Server VM (build 23.3-b01, mixed mode) >> >> *lsb_release -a* outputs : >> Distributor ID: Ubuntu >> Description: Ubuntu 12.04.5 LTS >> Release: 12.04 >> Codename: precise >> >> *uname -r* outputs: >> 3.1.10-1.9-ec2 >> >> *ES info* : ES 1.4.0 >> >> *Thanks in advance for the help.* >> >> Damien >> > -- > You received this message because you are subscribed to the Google Groups > "elasticsearch" group. > To unsubscribe from this group and stop receiving emails from it, send an > email to elasticsearch+unsubscr...@googlegroups.com. > To view this discussion on the web visit > https://groups.google.com/d/msgid/elasticsearch/25c5c56c-31ee-48c2-ab6f-081adf007868%40googlegroups.com > <https://groups.google.com/d/msgid/elasticsearch/25c5c56c-31ee-48c2-ab6f-081adf007868%40googlegroups.com?utm_medium=email&utm_source=footer> > . > > For more options, visit https://groups.google.com/d/optout. > -- You received this message because you are subscribed to the Google Groups "elasticsearch" group. To unsubscribe from this group and stop receiving emails from it, send an email to elasticsearch+unsubscr...@googlegroups.com. To view this discussion on the web visit https://groups.google.com/d/msgid/elasticsearch/CAPmjWd2%3DjYno4rAQdUaEuckXVAQQxPmLO9bCNU%3DKfi%2BLVHkJ5A%40mail.gmail.com. For more options, visit https://groups.google.com/d/optout.