forked from elastic/elasticsearch
    
        
        - 
                Notifications
    
You must be signed in to change notification settings  - Fork 0
 
Range Query
        kimchy edited this page Feb 4, 2011 
        ·
        1 revision
      
    Matches 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" : { 
            "from" : 10, 
            "to" : 20, 
            "include_lower" : true, 
            "include_upper": false, 
            "boost" : 2.0
        }
    }
}The range query top level parameters include:
- 
from: The lower bound. Defaults to start from the first. - 
to: The upper bound. Defaults to unbounded. - 
include_lower: Should the first from (if set) be inclusive or not. Defaults totrue. - 
include_upper: Should the last to (if set) be inclusive or not. Defaults totrue. - 
gt: Same as settingfromto the value, andinclude_lowertofalse. - 
gte: Same as settingfromto the value,andinclude_lowertotrue. - 
lt: Same as settingtoto the value, andinclude_uppertofalse. - 
lte: Same as settingtoto the value, andinclude_uppertotrue. - 
boost: Sets the boost value of the query. Defaults to1.0.