# Query string and number with match phrase

**URL:** <https://discuss.elastic.co/t/query-string-and-number-with-match-phrase/42736>\
**Category:** Elasticsearch\
**Created:** [February 25, 2016, 4:00pm UTC](https://discuss.elastic.co/t/query-string-and-number-with-match-phrase/42736 "2016-02-25T16:00:48Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![mendy](https://avatars.discourse-cdn.com/v4/letter/m/9fc29f/32.png) [@mendy](https://discuss.elastic.co/u/mendy)\
**Post date:** [February 25, 2016, 4:00pm UTC](https://discuss.elastic.co/t/query-string-and-number-with-match-phrase/42736/1 "2016-02-25T16:00:48Z")

</div>

i have field with type string and the data is like

{  
"extraDataTest": "my age is17 and my name is mike"  
}

the data and the query contains string and numbers. the data could be also like "my age is 17 and my name is mike". i want to able to do full text search on this field.

when i do this query :  
{  
"from": 1,  
"size": 25,  
"query": {  
"match": {  
"extraDataTest": {  
"type": "phrase",  
"query": "my age is 17"  
}  
}  
}  
}

the result is empty:  
{  
"took": 2,  
"timed\_out": false,  
"\_shards": {  
"total": 5,  
"successful": 5,  
"failed": 0  
},  
"hits": {  
"total": 0,  
"max\_score": null,  
"hits": []  
}  
}

please help me with any idea how to deal with

regards  
mendy

---

<div class="post-metadata">

**Author:** ![danielmitterdorfer](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/danielmitterdorfer/32/110510_2.png) [@danielmitterdorfer](https://discuss.elastic.co/u/danielmitterdorfer)\
**Post date:** [March 1, 2016, 11:23am UTC](https://discuss.elastic.co/t/query-string-and-number-with-match-phrase/42736/2 "2016-03-01T11:23:32Z")

</div>

Hi Mendy,

I think you just have a typo in the document that you index. Note that there is no spaced between "is" and "17" in your document but in the query there is one.

If I index a few documents:

```auto
POST /_bulk
{"index":{"_index":"my_app","_type":"people"}}
{"extraDataTest":"my age is 17 and my name is mike"}
{"index":{"_index":"my_app","_type":"people"}}
{"extraDataTest":"my age is 22 and my name is hanna"}
{"index":{"_index":"my_app","_type":"people"}}
{"extraDataTest":"my age is 13 and my name is hans"}
{"index":{"_index":"my_app","_type":"people"}}
{"extraDataTest":"my age is 88 and my name is joel"}

```

and then issue a query:

```auto
GET /my_app/_search
{
   "query": {
      "match": {
         "extraDataTest": {
            "query": "my age is 17",
            "type": "phrase"
         }
      }
   }
}

```

I get one result:

```auto
{
   "took": 2,
   "timed_out": false,
   "_shards": {
      "total": 5,
      "successful": 5,
      "failed": 0
   },
   "hits": {
      "total": 1,
      "max_score": 0.28767452,
      "hits": [
         {
            "_index": "my_app",
            "_type": "people",
            "_id": "AVMx6OM9vB34i1GBuXMp",
            "_score": 0.28767452,
            "_source": {
               "extraDataTest": "my age is17 and my name is mike"
            }
         }
      ]
   }
}

```

Daniel

---

<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:** [July 5, 2017, 11:12pm UTC](https://discuss.elastic.co/t/query-string-and-number-with-match-phrase/42736/3 "2017-07-05T23:12:32Z")

</div>


