# Elastic Field Types - Range Query

**URL:** <https://discuss.elastic.co/t/elastic-field-types-range-query/362249>\
**Category:** Elasticsearch\
**Created:** [June 30, 2024, 9:09am UTC](https://discuss.elastic.co/t/elastic-field-types-range-query/362249 "2024-06-30T09:09:06Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![Karthik\_Vaidyanathan](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/karthik_vaidyanathan/32/130566_2.png) [@Karthik\_Vaidyanathan](https://discuss.elastic.co/u/Karthik_Vaidyanathan)\
**Post date:** [June 30, 2024, 9:09am UTC](https://discuss.elastic.co/t/elastic-field-types-range-query/362249/1 "2024-06-30T09:09:06Z")

</div>

Hello All,  
Pretty new to using Elastic and currently using the Serverless option. I have a field called street number , currently it's stored as a text. It contains values which are both string and text:  
[100, 101A, 102A, 103, 105-B, 150,]  
My use case is I want to use a range query to get all street numbers between 100 & 110. It should output all values including the string values.  
My questions is

1. What's the best way to store this data and retrieve it?

---

<div class="post-metadata">

**Author:** ![carly.richmond](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/carly.richmond/32/104935_2.png) [@carly.richmond](https://discuss.elastic.co/u/carly.richmond)\
**Post date:** [July 1, 2024, 10:28am UTC](https://discuss.elastic.co/t/elastic-field-types-range-query/362249/2 "2024-07-01T10:28:32Z")

</div>

Hi @Karthik_Vaidyanathan,

Welcome to the community! Can you store the number element (101) and letter element (A) as a separate field, and then use a range query similar to the below:

```auto
GET /_search
{
  "query": {
    "range": {
      "house_number": {
        "gte": 100,
        "lte": 110
      }
    }
  }
}

```

Depending on how you are putting your data into Elasticsearch you could create a field with the number portion using different techniques such as:

1. Pulling the number element using a [runtime field](https://www.elastic.co/guide/en/elasticsearch/reference/current/runtime.html).
2. If you are using Logstash you could create the element using the [grok](https://www.elastic.co/guide/en/logstash/current/plugins-filters-grok.html) or [dissect](https://www.elastic.co/guide/en/logstash/current/plugins-filters-dissect.html) plugin.
3. Use similar dissect or grok processors via an [ingest pipeline](https://www.elastic.co/guide/en/elasticsearch/reference/current/pipeline-processor.html)

There will probably be a few other ways to create the field depending on how you are ingesting your data.

Let us know if that helps!
