# Match Prefix not giving any result

**URL:** <https://discuss.elastic.co/t/match-prefix-not-giving-any-result/138866>\
**Category:** Elasticsearch\
**Created:** [July 6, 2018, 9:05am UTC](https://discuss.elastic.co/t/match-prefix-not-giving-any-result/138866 "2018-07-06T09:05:08Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![aneesh](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/aneesh/32/37819_2.png) [@aneesh](https://discuss.elastic.co/u/aneesh)\
**Post date:** [July 6, 2018, 9:05am UTC](https://discuss.elastic.co/t/match-prefix-not-giving-any-result/138866/1 "2018-07-06T09:05:08Z")

</div>

Hi

i want to do substring search (Like operation)

```
get state/_search      
{
  "from":0,
  "size": 1000
  "query": {
    "bool": {
      "must": [
        {
          "match_phrase_prefix": {
            "StateName" : "*p*"
          }
        }
      ]
    }
    }

```

}

This not giving any results.

Thanks  
Aneesh

---

<div class="post-metadata">

**Author:** ![Prateek\_Gupta](https://avatars.discourse-cdn.com/v4/letter/p/f17d59/32.png) [@Prateek\_Gupta](https://discuss.elastic.co/u/Prateek_Gupta)\
**Post date:** [July 6, 2018, 9:08am UTC](https://discuss.elastic.co/t/match-prefix-not-giving-any-result/138866/2 "2018-07-06T09:08:05Z")

</div>

Prefix matches just the prefix part and doesn't allow wildcard match. If you want to do a like match you should use a match\_phrase query or if you want a wildcard match then use wildcard query.

---

<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:** [August 3, 2018, 9:08am UTC](https://discuss.elastic.co/t/match-prefix-not-giving-any-result/138866/3 "2018-08-03T09:08:13Z")

</div>

Closed on August 3, 2018, 9:08am UTC

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