A newer version of this documentation is available.

View Latest

Numeric Range Query

    March 16, 2025
    + 12

    A numeric range query finds documents containing a numeric value in the specified field within the specified range.

    Define the endpoints using the fields min and max. You can omit any one endpoint, but not both.

    The inclusive_min and inclusive_max properties control whether or not the endpoints are included or excluded.

    By default, min is inclusive and max is exclusive.

    A demonstration of the numeric range Query using the Java SDK can be found in Searching from the SDK.

    Example

    json
    { "min": 100, "max": 1000, "inclusive_min": false, "inclusive_max": false, "field": "id" }

    Numeric Ranges

    You can specify numeric ranges with the >, >=, <, and <= operators, each followed by a numeric value.

    Example

    json
    `reviews.ratings.Cleanliness:>4`

    The above qeury performs numeric range query on the reviews.ratings.Cleanliness field, for values greater than 4.