Skip to content
Snippets Groups Projects
Code owners
Assign users and groups as approvers for specific file changes. Learn more.

Range Query

More info about range query is in the official elasticsearch docs

Matches documents with fields that have terms within a certain range.

Simple example

{
    {
        "range" : {
            "age" : {
                "gte" : 10,
                "lte" : 20,
                "boost" : 2.0
            }
        }
    }
}

In DSL:

$rangeQuery = new RangeQuery(
    'age',
    [
        'gte' => 10,
        'lte' => 20,
        'boost' => 2.0,
    ]
);

$search = new Search();
$search->addQuery($rangeQuery);

$queryArray = $search->toArray();