# Wild card s not working as expected?

**URL:** <https://discuss.elastic.co/t/wild-card-s-not-working-as-expected/218980>\
**Category:** Elasticsearch\
**Created:** [February 12, 2020, 12:58pm UTC](https://discuss.elastic.co/t/wild-card-s-not-working-as-expected/218980 "2020-02-12T12:58:25Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![Prasanth\_MP](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/prasanth_mp/32/52805_2.png) [@Prasanth\_MP](https://discuss.elastic.co/u/Prasanth_MP)\
**Post date:** [February 12, 2020, 12:58pm UTC](https://discuss.elastic.co/t/wild-card-s-not-working-as-expected/218980/1 "2020-02-12T12:58:25Z")

</div>

Hi I am trying the following query

curl -X GET "10.10.9.1:9200/\_search?pretty" -H 'Content-Type: application/json' -d'  
{  
"query": {  
"bool": {  
"must": [  
{ "term": { "campaign\_id": "9cc8c9dc-c3a8-4f34-9736-ca6a0f6a04db" }},  
{ "term": { "flight\_id": "af387355-98f6-4c30-9f08-afe9ea06b72b" }},  
{ "range": { "@timestamp": { "gte": "2015-01-01" }}}  
],  
"should" : {  
"wildcard": { "recipient": { "value": "3400\*" } }  
}  
}  
}  
}'

I would expect the above curl request not return any data as the recipient fields in the index all begins with 420. however it returns results .

{  
"took" : 20,  
"timed\_out" : false,  
"\_shards" : {  
"total" : 41,  
"successful" : 41,  
"skipped" : 0,  
"failed" : 0  
},  
"hits" : {  
"total" : 500,  
"max\_score" : 1.001997,  
"hits" : [  
{  
"\_index" : "mep-reports-2020.02.11",  
"\_type" : "doc",  
"\_id" : "af387355-98f6-4c30-9f08-afe9ea06b72b-5E426A00",  
"\_score" : 1.001997,  
"\_source" : {  
"campaign\_name" : "Irish Elections",  
"nof\_segments" : "1",  
"msg\_text" : "RM0 testhttps://is.gd/h3hkbm",  
"@timestamp" : "2020-02-11T08:47:00.000Z",  
"submission\_ts" : "1581410820",  
"campaign\_id" : "9cc8c9dc-c3a8-4f34-9736-ca6a0f6a04db",  
"flight\_id" : "af387355-98f6-4c30-9f08-afe9ea06b72b",  
"flight\_name" : "Flight Tuesday 21",  
"recipient" : "420736315250",  
"inventory" : "SMS",  
"delivery\_ts" : "1581410824",  
"@version" : "1",  
"status" : "DELIVERED",  
"o\_error" : "INTERNAL\_SUCCESS",  
"sender" : "800111",  
"account\_id" : "270d13e6-2f4f-4d51-99d5-92ffba5f0cb6"  
}  
}  
}

any idea why it happens . i would expect no data should be returned becuase the wild card search for 3400\*

---

<div class="post-metadata">

**Author:** ![Prasanth\_MP](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/prasanth_mp/32/52805_2.png) [@Prasanth\_MP](https://discuss.elastic.co/u/Prasanth_MP)\
**Post date:** [February 12, 2020, 1:12pm UTC](https://discuss.elastic.co/t/wild-card-s-not-working-as-expected/218980/2 "2020-02-12T13:12:19Z")

</div>

i found the answer

curl -X GET "10.10.9.1:9200/\_search?pretty" -H 'Content-Type: application/json' -d'  
{  
"query": {

```
 "bool": {

   "must": [
    { "term": { "campaign_id": "9cc8c9dc-c3a8-4f34-9736-ca6a0f6a04db" }},
{ "term": { "flight_id": "af387355-98f6-4c30-9f08-afe9ea06b72b" }},
    { "range": { "@timestamp": { "gte": "2015-01-01" }}},
    { "wildcard": { "recipient": { "value": "3400*" } } }
  ]

```

}  
}  
}'

---

<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:** [March 11, 2020, 1:12pm UTC](https://discuss.elastic.co/t/wild-card-s-not-working-as-expected/218980/3 "2020-03-11T13:12:23Z")

</div>

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