> For the complete documentation index, see [llms.txt](https://docs.hyper-space.io/hyperspace-docs/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.hyper-space.io/hyperspace-docs/api-documentation/dsl-query-framework/candidate-generation-and-metadata-filtering/range-match.md).

# Range Match

The `range` query allow you to filter documents based on a specified range of values within a given field. It can be used for numeric and date fields.  The Range query uses the following terms:

* "gte": the document must be greater than or equals to the provided values
* "gt": the document must be greater than the provided values
* "lte": the document must be smaller than or equals to the provided values
* "lt": the document must be smaller than the provided values

**Example 1**:

{% code lineNumbers="true" %}

```python
{
  "query": {
    "range": {
      "date": {
        "gte": "2023-01-01",
        "lte": "2023-12-31"
      }
    }
  }
}
```

{% endcode %}

The above example requires candidates to have a field named "date" with values that are greater than or equal to "2023-01-01" and smaller than or equal to "2023-12-31".

**Example 2**:

{% code lineNumbers="true" %}

```python
{
  "query": {
    "range": {
      "datetime": {
        "gte": "2023-01-01T08:00:00",
        "lt": "2023-01-01T17:30:00""
      }
    }
  }
}
```

{% endcode %}

The above example requires candidates to have a field named "datetime" with values that are greater than or equal to "2023-01-01T08:00:00" and smaller than  "2023-01-01T17:30:00"".

**Example 3**:

{% code lineNumbers="true" %}

```json
{
  "query": {
    "range": {
      "price": {
        "gt": 10,
        "lte": 30
      }
    }
  }
}
```

{% endcode %}

The above example requires candidates to have a field named "price" with values that are greater than  "10" and smaller or equal to than  "30"".


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://docs.hyper-space.io/hyperspace-docs/api-documentation/dsl-query-framework/candidate-generation-and-metadata-filtering/range-match.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
