# ElasticSearch match query to field that contains number

**URL:** <https://discuss.elastic.co/t/elasticsearch-match-query-to-field-that-contains-number/150100>\
**Category:** Elasticsearch\
**Created:** [September 27, 2018, 1:30am UTC](https://discuss.elastic.co/t/elasticsearch-match-query-to-field-that-contains-number/150100 "2018-09-27T01:30:37Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![Timotius\_Pamungkas](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/timotius_pamungkas/32/42522_2.png) [@Timotius\_Pamungkas](https://discuss.elastic.co/u/Timotius_Pamungkas)\
**Post date:** [September 27, 2018, 1:30am UTC](https://discuss.elastic.co/t/elasticsearch-match-query-to-field-that-contains-number/150100/1 "2018-09-27T01:30:37Z")

</div>

In my data, I have field `name` that contains values like this

- 1234\_Customer xxx
- 2345\_Customer yyy
- 5678\_Customer zzz

When I'm trying to do match query with text, it works

```
{
    "query": {
        "match": {
            "name": {
                "query": "customer",
                "operator": "and"
            }
        }
    }
}

```

But when I'm trying to find using number at front (it's a customer ID), nothing shown up

```
{
    "query": {
        "match": {
            "name": {
                "query": "123",
                "operator": "and"
            }
        }
    }
}

```

Is there something else to do before querying? Or I need to use different query?  
I think it has something to do with pattern, since between number and first word is \_ (underscore)?

Thank you

---

<div class="post-metadata">

**Author:** ![pranav24](https://avatars.discourse-cdn.com/v4/letter/p/b19c9b/32.png) [@pranav24](https://discuss.elastic.co/u/pranav24)\
**Post date:** [September 27, 2018, 8:33am UTC](https://discuss.elastic.co/t/elasticsearch-match-query-to-field-that-contains-number/150100/2 "2018-09-27T08:33:42Z")

</div>

Could you please provide your mapping file.  
Have you used any type of analyzers?

---

<div class="post-metadata">

**Author:** ![system](https://us1.discourse-cdn.com/elastic/original/3X/1/a/1ac57faf039f6b580b3f104ef42a2a89e41014de.png) [@system](https://discuss.elastic.co/u/system)\
**Post date:** [October 25, 2018, 8:33am UTC](https://discuss.elastic.co/t/elasticsearch-match-query-to-field-that-contains-number/150100/3 "2018-10-25T08:33:44Z")

</div>

This topic was automatically closed 28 days after the last reply. New replies are no longer allowed.
