WARNING: Version 1.3 of Elasticsearch has passed its EOL date.
This documentation is no longer being maintained and may be removed. If you are running this version, we strongly advise you to upgrade. For the latest information, see the current release documentation.
Range Query
editRange Query
editMatches documents with fields that have terms within a certain range.
The type of the Lucene query depends on the field type, for string
fields, the TermRangeQuery
, while for number/date fields, the query is
a NumericRangeQuery
. The following example returns all documents where
age
is between 10
and 20
:
{ "range" : { "age" : { "gte" : 10, "lte" : 20, "boost" : 2.0 } } }
The range
query accepts the following parameters:
|
Greater-than or equal to |
|
Greater-than |
|
Less-than or equal to |
|
Less-than |
|
Sets the boost value of the query, defaults to |