Elasticsearch version: 6.0.0-alpha1
{
"name" : "h-kwj5D",
"cluster_name" : "esvm-dev",
"cluster_uuid" : "FZXa27h5RbO9qPzM70GgCg",
"version" : {
"number" : "6.0.0-alpha1",
"build_hash" : "23a271f",
"build_date" : "2016-11-07T18:34:59.198Z",
"build_snapshot" : true,
"lucene_version" : "6.3.0"
},
"tagline" : "You Know, for Search"
}
Plugins installed: []
JVM version: 1.8.0_112
OS version: Linux troy 4.8.7-2-ck #1 SMP PREEMPT Sat Nov 12 06:48:05 EST 2016 x86_64 GNU/Linux
Description of the problem including expected versus actual behavior:
A range query on a numeric field fails if:
- the mapping is long; and
- a bound is decimal.
However, a range aggregation on that field succeeds. I think the behaviour should be consistent, i.e., failing in one should also fail in the other.
Steps to reproduce:
Data
curl -XDELETE 'localhost:9200/float,long'
curl -XPUT 'localhost:9200/float' -d '
{
"mappings": {
"Float": {
"properties": {
"number": {
"type": "float"
}
}
}
}
}'
curl -XPOST 'localhost:9200/float/Float' -d "$(jo number=18)"
curl -XPOST 'localhost:9200/float/Float' -d "$(jo number=19)"
curl -XPOST 'localhost:9200/float/Float' -d "$(jo number=20)"
curl -XPOST 'localhost:9200/float/Float' -d "$(jo number=21)"
curl -XPOST 'localhost:9200/float/Float' -d "$(jo number=22)"
curl -XPOST 'localhost:9200/long/Long' -d "$(jo number=18)"
curl -XPOST 'localhost:9200/long/Long' -d "$(jo number=19)"
curl -XPOST 'localhost:9200/long/Long' -d "$(jo number=20)"
curl -XPOST 'localhost:9200/long/Long' -d "$(jo number=21)"
curl -XPOST 'localhost:9200/long/Long' -d "$(jo number=22)"
Range Query
The following query fails on the long index:
curl 'localhost:9200/long/_search' -d '
{
"query": {
"range": {
"number": {
"lt": 20.1
}
}
}
}
'
The error is:
Value [20.1] has a decimal part
Range Aggregation
The following range aggregation returns the same results on both indices:
curl 'localhost:9200/long/_search' -d '
{
"aggs": {
"agg": {
"range": {
"field": "number",
"ranges": [
{
"from": 0,
"to": 20.1
}
],
"keyed": true
}
}
}
}
'
Result:
{
"took": 2,
"timed_out": false,
"_shards": {
"total": 5,
"successful": 5,
"failed": 0
},
"hits": {
"total": 5,
"max_score": 0,
"hits": []
},
"aggregations": {
"agg": {
"buckets": {
"0.0-20.1": {
"from": 0,
"to": 20.1,
"doc_count": 3
}
}
}
}
}
Elasticsearch version: 6.0.0-alpha1
{ "name" : "h-kwj5D", "cluster_name" : "esvm-dev", "cluster_uuid" : "FZXa27h5RbO9qPzM70GgCg", "version" : { "number" : "6.0.0-alpha1", "build_hash" : "23a271f", "build_date" : "2016-11-07T18:34:59.198Z", "build_snapshot" : true, "lucene_version" : "6.3.0" }, "tagline" : "You Know, for Search" }Plugins installed: []
JVM version: 1.8.0_112
OS version: Linux troy 4.8.7-2-ck #1 SMP PREEMPT Sat Nov 12 06:48:05 EST 2016 x86_64 GNU/Linux
Description of the problem including expected versus actual behavior:
A range query on a numeric field fails if:
However, a range aggregation on that field succeeds. I think the behaviour should be consistent, i.e., failing in one should also fail in the other.
Steps to reproduce:
Data
Range Query
The following query fails on the
longindex:The error is:
Range Aggregation
The following range aggregation returns the same results on both indices:
Result:
{ "took": 2, "timed_out": false, "_shards": { "total": 5, "successful": 5, "failed": 0 }, "hits": { "total": 5, "max_score": 0, "hits": [] }, "aggregations": { "agg": { "buckets": { "0.0-20.1": { "from": 0, "to": 20.1, "doc_count": 3 } } } } }