ES seems to be aliasing the byte type to the short type

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+unsubscribe@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/elasticsearch/2af44e04-e495-4641-a275-348d6ce73d5b%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

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+unsubscribe@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/elasticsearch/25c5c56c-31ee-48c2-ab6f-081adf007868%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

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.montigny@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+unsubscribe@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+unsubscribe@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.

Isn't ther anyone here who belongs to the core ES team and could answer
this question ?
I thought this was the good place to ask but I'm not sure anymore, maybe I
misread the documentation.

Le mercredi 3 décembre 2014 15:37:55 UTC+1, Nikolas Everett a écrit :

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....@gmail.com
<javascript:>> 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 elasticsearc...@googlegroups.com <javascript:>.
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+unsubscribe@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/elasticsearch/3a3cf99f-8233-4a5b-b22d-a49ff5e30a95%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Damien,

I think that Nikolas’s answer is correct. I would then suggest to open a bug with all the details you sent to the mailing list.

Best

--
David Pilato | Technical Advocate | Elasticsearch.com
@dadoonet https://twitter.com/dadoonet | @elasticsearchfr https://twitter.com/elasticsearchfr | @scrutmydocs https://twitter.com/scrutmydocs

Le 5 déc. 2014 à 14:41, Damien Montigny damien.montigny@gmail.com a écrit :

Isn't ther anyone here who belongs to the core ES team and could answer this question ?
I thought this was the good place to ask but I'm not sure anymore, maybe I misread the documentation.

Le mercredi 3 décembre 2014 15:37:55 UTC+1, Nikolas Everett a écrit :
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....@gmail.com <javascript:>> 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 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 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 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 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 elasticsearc...@googlegroups.com <javascript:>.
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 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+unsubscribe@googlegroups.com mailto:elasticsearch+unsubscribe@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/elasticsearch/3a3cf99f-8233-4a5b-b22d-a49ff5e30a95%40googlegroups.com https://groups.google.com/d/msgid/elasticsearch/3a3cf99f-8233-4a5b-b22d-a49ff5e30a95%40googlegroups.com?utm_medium=email&utm_source=footer.
For more options, visit https://groups.google.com/d/optout 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+unsubscribe@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/elasticsearch/EE852439-8B24-43A4-8BB0-1F4B1DA5674D%40pilato.fr.
For more options, visit https://groups.google.com/d/optout.