# Achieve autocomplete with fuzziness

**URL:** <https://discuss.elastic.co/t/achieve-autocomplete-with-fuzziness/170281>\
**Category:** Elasticsearch\
**Created:** [February 28, 2019, 6:32am UTC](https://discuss.elastic.co/t/achieve-autocomplete-with-fuzziness/170281 "2019-02-28T06:32:35Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![roxcity](https://avatars.discourse-cdn.com/v4/letter/r/5e9695/32.png) [@roxcity](https://discuss.elastic.co/u/roxcity)\
**Post date:** [February 28, 2019, 6:32am UTC](https://discuss.elastic.co/t/achieve-autocomplete-with-fuzziness/170281/1 "2019-02-28T06:32:35Z")

</div>

I am trying to achieve autocomplete with a level of fuzziness. I tried different settings with the help of documentation.

My configuration:  
`PUT http://localhost:9200/my_index/ { "settings": { "analysis": { "analyzer": { "folding": { "tokenizer": "standard", "filter": ["lowercase", "asciifolding", "umlaut", "ngram_filter"] }, "folding_search": { "tokenizer": "standard", "filter": ["lowercase", "asciifolding", "umlaut"] } }, "filter": { "umlaut": { "type": "snowball", "language": "German2" }, "ngram_filter": { "type": "edge_ngram", "min_gram": 1, "max_gram": 25 } } } }, "mappings": { "_doc": { "properties": { "full_name": { "type": "text", "analyzer": "standard", "fields": { "folded": { "type": "text", "analyzer": "folding", "search_analyzer": "folding_search" } } } } } } }`

I added data using the following command:  
`  
curl -X POST "localhost:9200/my\_index/\_doc/\_bulk" -H 'Content-Type: application/json' -d'

{ "index": { "\_id": "1" } }

{ "full\_name": ["brown fox"] }

{ "index": { "\_id": "2" } }

{ "full\_name": ["fox"] }

{ "index": { "\_id": "3" } }

{ "full\_name": ["quick brown fox"] }

{ "index": { "\_id": "4" } }

{ "full\_name": ["brown brown brown"] }

{ "index": { "\_id": "5" } }

{ "full\_name": ["brown color"] }

{ "index": { "\_id": "6" } }

{ "full\_name": ["fox is clever"] }

{ "index": { "\_id": "8" } }

{ "full\_name": ["quick jump"] }

{ "index": { "\_id": "9" } }

{ "full\_name": ["brown table"] }

{ "index": { "\_id": "10" } }

{ "full\_name": ["brown shirt"] }

{ "index": { "\_id": "11" } }

{ "full\_name": ["blue shirt"] }

{ "index": { "\_id": "12" } }

{ "full\_name": ["brown foxi"] }

{ "index": { "\_id": "13" } }

{ "full\_name": ["fox"] }

{ "index": { "\_id": "14" } }

{ "full\_name": ["orange"] }

{ "index": { "\_id": "15" } }

{ "full\_name": ["grapes"] }

{ "index": { "\_id": "16" } }

{ "full\_name": ["fish"] }

{ "index": { "\_id": "17" } }

{ "full\_name": ["brown fish"] }

{ "index": { "\_id": "18" } }

'  
`

My query is:  
`POST http://localhost:9200/my_index/_search { "query": { "multi_match": { "query": "brown fox", "fields": ["full_name", "full_name.folded"], "fuzziness": 1 } } }`

When I searched for "brown fox", what I expected the result to be is "brown fox" and "brown foxi" at the top (with high score), but what I got is different:  
"brown foxi"  
"brown brown brown"  
"quick brown fox"  
"brown fox"

How can I resolve this? Please help.

Thanks.

---

<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 28, 2019, 6:32am UTC](https://discuss.elastic.co/t/achieve-autocomplete-with-fuzziness/170281/2 "2019-03-28T06:32:37Z")

</div>

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