# Match phrase prefix is not working as expectet with numeric tokens

**URL:** <https://discuss.elastic.co/t/match-phrase-prefix-is-not-working-as-expectet-with-numeric-tokens/180002>\
**Category:** Elasticsearch\
**Created:** [May 7, 2019, 2:14pm UTC](https://discuss.elastic.co/t/match-phrase-prefix-is-not-working-as-expectet-with-numeric-tokens/180002 "2019-05-07T14:14:53Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![harrallo](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/harrallo/32/45743_2.png) [@harrallo](https://discuss.elastic.co/u/harrallo)\
**Post date:** [May 7, 2019, 2:14pm UTC](https://discuss.elastic.co/t/match-phrase-prefix-is-not-working-as-expectet-with-numeric-tokens/180002/1 "2019-05-07T14:14:53Z")

</div>

I have a tricky problem: If I search for a prefix that ends with a partial number, the search does not return any results.

**ES version: 6.1 for .NET**

**Index settings**  
`{ "document_idx": { "settings": { "index": { "provided_name": "document_idx", "analysis": { "filter": { "FoldingTokenFilter": { "type": "asciifolding", "preserve_original": "true" } }, "analyzer": { "FullTextAnalyzer": { "filter": ["lowercase", "FoldingTokenFilter"], "type": "custom", "tokenizer": "standard" } } } } } } }`

**Index mapping**  
`{ "document_idx": { "mappings": { "documentmapping": { "_source": { "enabled": false }, "properties": { "fullTextField": { "type": "text", "norms": false, "analyzer": "FullTextAnalyzer" } } } } } }`

**The field value, that gets in at index time**  
Document - ABC-123-2019, DE100006, 520 USD

**The search query that gets the wanted hit (last number is an exact match)**  
`GET document_idx/_search? { "query": { "bool": { "must": [{ "match_phrase_prefix": { "fullTextField": { "query": "ABC-123-2019" } } }], "minimum_should_match": 0 } } }`

**The search query that DOES NOT get me any hits (last number is partial)**  
`GET document_idx/_search? { "query": { "bool": { "must": [{ "match_phrase_prefix": { "fullTextField": { "query": "ABC-123-201" } } }], "minimum_should_match": 0 } } }`

**Another NOT WORKING query, that does not get me any hits (first word is partial)** - I don't know if this should work  
`GET document_idx/_search? { "query": { "bool": { "must": [{ "match_phrase_prefix": { "fullTextField": { "query": "AB 123-2019" } } }], "minimum_should_match": 0 } } }`

Can anyone please explain me why elastic search works as observed.  
Does it have to do something with the index time tokens of type `<NUM>`?  
Because if the last word is not numeric, than the partial search works like a charm.

And please, do not tell me to use Ngram or similar. fullTextField is enormous. And I need to start searching from a single character input on...

---

<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:** [June 4, 2019, 2:28pm UTC](https://discuss.elastic.co/t/match-phrase-prefix-is-not-working-as-expectet-with-numeric-tokens/180002/2 "2019-06-04T14:28:22Z")

</div>

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