Elasticsearch version: 5.1.1
JVM version: 1.8.0_111
OS version: CentOS 6.8
Description of the problem including expected versus actual behavior:
When there are 2 documents, 1 with value 0.0 and the other with value -0.0, ES 5.1.1 no longer returns the documents when a range query is execute with either gt -0.0 or lt 0.0. Where as ES 2.4.3 would return the document with value 0.0 for gt -0.0 and return the document with value -0.0 for lt 0.0.
lte and gte do work correctly, lte 0.0 and gte -0.0 return both documents
Steps to reproduce:
curl -XPUT localhost:9200/double-test?pretty -d '{ "mappings": { "double-values": { "properties": { "number": { "type": "double" }}}}}'
{
"acknowledged" : true,
"shards_acknowledged" : true
}
curl -XPOST localhost:9200/double-testing/double-values?pretty -d '{ "number": 0.0 }'
{
"_index" : "double-testing",
"_type" : "double-values",
"_id" : "AVj9f_B77DB0gWTRwMi9",
"_version" : 1,
"result" : "created",
"_shards" : {
"total" : 2,
"successful" : 1,
"failed" : 0
},
"created" : true
}
curl -XPOST localhost:9200/double-testing/double-values?pretty -d '{ "number": -0.0 }'
{
"_index" : "double-testing",
"_type" : "double-values",
"_id" : "AVj9f_087DB0gWTRwMi-",
"_version" : 1,
"result" : "created",
"_shards" : {
"total" : 2,
"successful" : 1,
"failed" : 0
},
"created" : true
}
curl localhost:9200/double-testing/double-values/_search?pretty
{
"took" : 2,
"timed_out" : false,
"_shards" : {
"total" : 5,
"successful" : 5,
"failed" : 0
},
"hits" : {
"total" : 2,
"max_score" : 1.0,
"hits" : [
{
"_index" : "double-testing",
"_type" : "double-values",
"_id" : "AVj9f_B77DB0gWTRwMi9",
"_score" : 1.0,
"_source" : {
"number" : -0.0
}
},
{
"_index" : "double-testing",
"_type" : "double-values",
"_id" : "AVj9f_087DB0gWTRwMi-",
"_score" : 1.0,
"_source" : {
"number" : 0.0
}
}
]
}
}
curl localhost:9200/double-testing/double-values/_search?pretty -d '{ "query": { "range": { "number": { "lt": 0.0 }}}}'
{
"took" : 2,
"timed_out" : false,
"_shards" : {
"total" : 5,
"successful" : 5,
"failed" : 0
},
"hits" : {
"total" : 0,
"max_score" : null,
"hits" : [ ]
}
}
curl localhost:9200/double-testing/double-values/_search?pretty -d '{ "query": { "range": { "number": { "lte": 0.0 }}}}'
{
"took" : 1,
"timed_out" : false,
"_shards" : {
"total" : 5,
"successful" : 5,
"failed" : 0
},
"hits" : {
"total" : 2,
"max_score" : 1.0,
"hits" : [
{
"_index" : "double-testing",
"_type" : "double-values",
"_id" : "AVj9f_B77DB0gWTRwMi9",
"_score" : 1.0,
"_source" : {
"number" : -0.0
}
},
{
"_index" : "double-testing",
"_type" : "double-values",
"_id" : "AVj9f_087DB0gWTRwMi-",
"_score" : 1.0,
"_source" : {
"number" : 0.0
}
}
]
}
}
curl localhost:9200/double-testing/double-values/_search?pretty -d '{ "query": { "range": { "number": { "gt": -0.0 }}}}'
{
"took" : 1,
"timed_out" : false,
"_shards" : {
"total" : 5,
"successful" : 5,
"failed" : 0
},
"hits" : {
"total" : 0,
"max_score" : null,
"hits" : [ ]
}
}
curl localhost:9200/double-testing/double-values/_search?pretty -d '{ "query": { "range": { "number": { "gte": -0.0 }}}}'
{
"took" : 2,
"timed_out" : false,
"_shards" : {
"total" : 5,
"successful" : 5,
"failed" : 0
},
"hits" : {
"total" : 2,
"max_score" : 1.0,
"hits" : [
{
"_index" : "double-testing",
"_type" : "double-values",
"_id" : "AVj9f_B77DB0gWTRwMi9",
"_score" : 1.0,
"_source" : {
"number" : -0.0
}
},
{
"_index" : "double-testing",
"_type" : "double-values",
"_id" : "AVj9f_087DB0gWTRwMi-",
"_score" : 1.0,
"_source" : {
"number" : 0.0
}
}
]
}
}
Elasticsearch version: 5.1.1
JVM version: 1.8.0_111
OS version: CentOS 6.8
Description of the problem including expected versus actual behavior:
When there are 2 documents, 1 with value 0.0 and the other with value -0.0, ES 5.1.1 no longer returns the documents when a range query is execute with either gt -0.0 or lt 0.0. Where as ES 2.4.3 would return the document with value 0.0 for gt -0.0 and return the document with value -0.0 for lt 0.0.
lte and gte do work correctly, lte 0.0 and gte -0.0 return both documents
Steps to reproduce:
curl -XPUT localhost:9200/double-test?pretty -d '{ "mappings": { "double-values": { "properties": { "number": { "type": "double" }}}}}'{ "acknowledged" : true, "shards_acknowledged" : true }curl -XPOST localhost:9200/double-testing/double-values?pretty -d '{ "number": 0.0 }'{ "_index" : "double-testing", "_type" : "double-values", "_id" : "AVj9f_B77DB0gWTRwMi9", "_version" : 1, "result" : "created", "_shards" : { "total" : 2, "successful" : 1, "failed" : 0 }, "created" : true }curl -XPOST localhost:9200/double-testing/double-values?pretty -d '{ "number": -0.0 }'{ "_index" : "double-testing", "_type" : "double-values", "_id" : "AVj9f_087DB0gWTRwMi-", "_version" : 1, "result" : "created", "_shards" : { "total" : 2, "successful" : 1, "failed" : 0 }, "created" : true }curl localhost:9200/double-testing/double-values/_search?pretty{ "took" : 2, "timed_out" : false, "_shards" : { "total" : 5, "successful" : 5, "failed" : 0 }, "hits" : { "total" : 2, "max_score" : 1.0, "hits" : [ { "_index" : "double-testing", "_type" : "double-values", "_id" : "AVj9f_B77DB0gWTRwMi9", "_score" : 1.0, "_source" : { "number" : -0.0 } }, { "_index" : "double-testing", "_type" : "double-values", "_id" : "AVj9f_087DB0gWTRwMi-", "_score" : 1.0, "_source" : { "number" : 0.0 } } ] } }curl localhost:9200/double-testing/double-values/_search?pretty -d '{ "query": { "range": { "number": { "lt": 0.0 }}}}'{ "took" : 2, "timed_out" : false, "_shards" : { "total" : 5, "successful" : 5, "failed" : 0 }, "hits" : { "total" : 0, "max_score" : null, "hits" : [ ] } }curl localhost:9200/double-testing/double-values/_search?pretty -d '{ "query": { "range": { "number": { "lte": 0.0 }}}}'{ "took" : 1, "timed_out" : false, "_shards" : { "total" : 5, "successful" : 5, "failed" : 0 }, "hits" : { "total" : 2, "max_score" : 1.0, "hits" : [ { "_index" : "double-testing", "_type" : "double-values", "_id" : "AVj9f_B77DB0gWTRwMi9", "_score" : 1.0, "_source" : { "number" : -0.0 } }, { "_index" : "double-testing", "_type" : "double-values", "_id" : "AVj9f_087DB0gWTRwMi-", "_score" : 1.0, "_source" : { "number" : 0.0 } } ] } }curl localhost:9200/double-testing/double-values/_search?pretty -d '{ "query": { "range": { "number": { "gt": -0.0 }}}}'{ "took" : 1, "timed_out" : false, "_shards" : { "total" : 5, "successful" : 5, "failed" : 0 }, "hits" : { "total" : 0, "max_score" : null, "hits" : [ ] } }curl localhost:9200/double-testing/double-values/_search?pretty -d '{ "query": { "range": { "number": { "gte": -0.0 }}}}'{ "took" : 2, "timed_out" : false, "_shards" : { "total" : 5, "successful" : 5, "failed" : 0 }, "hits" : { "total" : 2, "max_score" : 1.0, "hits" : [ { "_index" : "double-testing", "_type" : "double-values", "_id" : "AVj9f_B77DB0gWTRwMi9", "_score" : 1.0, "_source" : { "number" : -0.0 } }, { "_index" : "double-testing", "_type" : "double-values", "_id" : "AVj9f_087DB0gWTRwMi-", "_score" : 1.0, "_source" : { "number" : 0.0 } } ] } }