# Fuzziness is not given results in Match query

**URL:** <https://discuss.elastic.co/t/fuzziness-is-not-given-results-in-match-query/26056>\
**Category:** Elasticsearch\
**Created:** [July 22, 2015, 8:47am UTC](https://discuss.elastic.co/t/fuzziness-is-not-given-results-in-match-query/26056 "2015-07-22T08:47:39Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![anusha6](https://avatars.discourse-cdn.com/v4/letter/a/a5b964/32.png) [@anusha6](https://discuss.elastic.co/u/anusha6)\
**Post date:** [July 22, 2015, 8:47am UTC](https://discuss.elastic.co/t/fuzziness-is-not-given-results-in-match-query/26056/1 "2015-07-22T08:47:39Z")

</div>

Hi All,

I am using the following query to get the results based in 'id' field..

GET ast/ast\_type/\_search  
{  
"query": {  
"bool": {  
"must": [  
{  
"match": {  
"id":  
{  
"query": "1",  
"type": "phrase\_prefix"  
}

```
             }
           },
           {
              "match": {
                  "id":
                {
                    "query": "m",
                    "type": "phrase_prefix"
                }
              }
           }
        ]
    }
},
"sort": [
   {
      "priority": {
         "order": "desc"
      }
   },
   {
      "name": {
         "order": "asc"
      }
   }
]

```

}

This query is giving the results as shown( expected):  
"hits": [  
{  
"\_index": "ast",  
"\_type": "ast\_type",  
"\_id": "AU6GL-sL3NytkeZBXYKh",  
"\_score": null,  
"\_source": {  
"id": "mobil 1",  
"priority": 1,  
"name": "mobil 1"  
},  
"sort": [  
1,  
"mobil 1"  
]  
}  
]

As I have only one document with prefix '1' and 'm' in two words I got this result,

But when am adding fuzziness am not getting that response document("mobil 1"):

"must": [  
{  
"match": {  
"id":  
{  
"query": "1",  
"type": "phrase\_prefix", "fuzziness":1,"prefix\_length":1  
}

```
             }
           },
           {
              "match": {
                  "id":
                {
                    "query": "m",
                    "type": "phrase_prefix","fuzziness":1,"prefix_length":1
                }
              }
           }
        ]

```

Can anyone please guide me to resolve this issue...

---

<div class="post-metadata">

**Author:** ![anusha6](https://avatars.discourse-cdn.com/v4/letter/a/a5b964/32.png) [@anusha6](https://discuss.elastic.co/u/anusha6)\
**Post date:** [July 22, 2015, 8:52am UTC](https://discuss.elastic.co/t/fuzziness-is-not-given-results-in-match-query/26056/2 "2015-07-22T08:52:50Z")

</div>

If need these are my mappings:

"mappings": {  
"ast\_type": {  
"properties": {  
"id": {  
"type": "string",  
"analyzer": "analyzer\_startswith"  
},  
"name": {  
"type": "string",  
"analyzer": "keyword\_analyzer"  
},  
"priority": {  
"type": "long"  
}  
}  
}

Where name and priority fields are using for sorting.  
And the respective settings:

analysis:  
{  
"analyzer": {  
"keyword\_analyzer": {  
"filter": "lowercase",  
"tokenizer": "keyword"  
},  
"analyzer\_startswith": {  
"filter": [  
"lowercase"  
],  
"tokenizer": "whitespace"  
},  
"wordAnalyzer": {  
"type": "custom",  
"filter": [  
"lowercase",  
"asciifolding",  
"nGram\_filter"  
],  
"tokenizer": "whitespace"  
},  
"whitespace\_analyzer": {  
"type": "custom",  
"filter": [  
"lowercase",  
"asciifolding"  
],  
"tokenizer": "whitespace"  
}  
},  
"filter": {  
"nGram\_filter": {  
"max\_gram": "20",  
"min\_gram": "1",  
"type": "nGram",  
"token\_chars": [  
"letter",  
"digit",  
"punctuation",  
"symbol"  
]  
}  
}  
}

Using only two 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:** [July 6, 2017, 12:00am UTC](https://discuss.elastic.co/t/fuzziness-is-not-given-results-in-match-query/26056/3 "2017-07-06T00:00:01Z")

</div>


