-
Notifications
You must be signed in to change notification settings - Fork 25.6k
Description
Certain values, such as blood pH and body temperature in Celcius, require precision to the tenths or hundredths place. They also have very little variance. Blood pH ranges between 7.3 and 7.5. Body temperatures range between 35 and 40.
In 0.90.5, the smallest supported interval currently is the smallest positive integer 1. If an interval of 0.1 is submitted, a parse error is returned, claiming that [interval] is required to be set for histogram facet.
To support histograms of fields with precision smaller than 1, elasticsearch should support intervals of decimal type. No new functionality is proposed, just changing the type of the interval from integer to double/float.
The following cURL setup and search:
curl -XPUT localhost:9200/test/test/1 -d '{ "value": 1.1 }'
curl -XPUT localhost:9200/test/test/2 -d '{ "value": 1.2 }'
curl -XPOST "http://localhost:9200/test/test/_search" -d'
{
"query": {
"match_all": {}
},
"size": 0,
"facets": {
"hist": {
"histogram": {
"field": "value",
"interval": 0.1
}
}
}
}'
Should produce the following histogram:
"entries": [
{
"key": 1.1,
"count": 1
},
{
"key": 1.2,
"count": 1
}
]