Range query #
Returns documents that contain terms within a provided range.
Inside a
nestedquery: supported — the bounds apply per array element.
Examples #
The following search returns the sales whose price is between 45 and
60 — 20 of the 120 documents in the sales dataset.
GET /_search
{
"query": {
"range": {
"field": "age",
"gte": 10,
"lte": 20
}
}
}
Parameters for range
#
field
(Required, string) Field you wish to search.gt
(Optional) Greater than.gte
(Optional) Greater than or equal to.lt
(Optional) Less than.lte
(Optional) Less than or equal to.format
(Optional, string) Date format for date-field range bounds.time_zone
(Optional, string) Time zone for date-field range bounds, e.g.+08:00.boost
(Optional, float, default:1.0) Decrease or increase the relevance scores of the query.relation
(Optional, string) How the range matchesrange-typed fields:INTERSECTS(default),CONTAINS, orWITHIN.