It's nice to see that there is now a "range" data type:
https://www.elastic.co/guide/en/elasticsearch/reference/current/range.html
The example only shows how to do a range query against a range field.
Is there a way to do a simple term query against a range field?
i.e. a way to find documents for which a specified value falls within the range?
I was hoping that I could do this, but it does not work:
DELETE /foo
PUT /foo
{
"mappings": {
"foo": {
"properties": {
"myrange": {"type": "integer_range"}
}
}
}
}
POST /foo/foo
{
"myrange": {
"gte": 10,
"lte": 20
}
}
POST /foo/foo
{
"myrange": {
"gte": 20,
"lte": 30
}
}
GET /foo/foo/_search
{
"query": {
"term": {
"myrange": {
"value": 15
}
}
}
}
The query fails with:
Field [myrange] of type [integer_range] does not support range queries