# Fuzziness AUTO doesn't work as expected

**URL:** <https://discuss.elastic.co/t/fuzziness-auto-doesnt-work-as-expected/19982>\
**Category:** Elasticsearch\
**Created:** [September 26, 2014, 3:22pm UTC](https://discuss.elastic.co/t/fuzziness-auto-doesnt-work-as-expected/19982 "2014-09-26T15:22:49Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![David\_Klotz](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/david_klotz/32/855_2.png) [@David\_Klotz](https://discuss.elastic.co/u/David_Klotz)\
**Post date:** [September 26, 2014, 3:22pm UTC](https://discuss.elastic.co/t/fuzziness-auto-doesnt-work-as-expected/19982/1 "2014-09-26T15:22:49Z")

</div>

Hi,

I'm currently having some issues with a search that's using Fuzziness.AUTO.

First a remark on how AUTO is documented, the documentation says:

"For lengths: 0..1 must match exactly, 1..4 one edit allowed, \>4 two edits  
allowed". That is a bit ambigue, how is a term with length 1 treated? I'm  
guessing it has to match, but the documentation could be interpreted  
otherwise. And what exactly would a term of length 0 be?

Now to my problem: I have an index containing a field that has information  
like street addresses in it, e.g. "Somestreet 38", now I want a fuzzy match  
query (with operator AND) for "somestreet 39" or "somestreet 38a" to match  
the document with a field value of "Somestreet 38". This works with the  
fuzziness of the query set to 1 or 2, but not with AUTO. "38" and "39"  
should both be terms with length 2, and their edit distance should be 1,  
right? So according to the documentation quoted above, the query should  
match.

To reproduce, create index and example document with:

curl -XPUT 'localhost:9200/addresses?pretty'  
curl -XPUT 'localhost:9200/addresses/sometype/1?pretty' -d '  
{  
"street": "Somestreet 38"  
}'

The following query should have one match, but doesn't:

curl -XGET 'localhost:9200/addresses/\_search?pretty' -d '  
{  
"query" : {  
"match" : {  
"street" : {  
"query" : "somestreet 39",  
"operator" : "and",  
"fuzziness" : "AUTO"  
}  
}  
}  
}'

If you change the fuzziness to "1" or "2", the query correctly returns one  
hit.

Is my interpretation of the docs off or is the implementation of AUTO  
inconsistent with the docs?

Cheers,  
David

--  
You received this message because you are subscribed to the Google Groups "elasticsearch" group.  
To unsubscribe from this group and stop receiving emails from it, send an email to [elasticsearch+unsubscribe@googlegroups.com](mailto:elasticsearch+unsubscribe@googlegroups.com).  
To view this discussion on the web visit [https://groups.google.com/d/msgid/elasticsearch/49eff5ba-8e23-470d-bc23-501c934a88ea%40googlegroups.com](https://groups.google.com/d/msgid/elasticsearch/49eff5ba-8e23-470d-bc23-501c934a88ea%40googlegroups.com).  
For more options, visit [https://groups.google.com/d/optout](https://groups.google.com/d/optout).

---

<div class="post-metadata">

**Author:** ![David\_Klotz](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/david_klotz/32/855_2.png) [@David\_Klotz](https://discuss.elastic.co/u/David_Klotz)\
**Post date:** [September 29, 2014, 8:34am UTC](https://discuss.elastic.co/t/fuzziness-auto-doesnt-work-as-expected/19982/2 "2014-09-29T08:34:56Z")

</div>

Hi,

On Friday, September 26, 2014 5:22:49 PM UTC+2, David Klotz wrote:

> I'm currently having some issues with a search that's using Fuzziness.AUTO.  
> [...]  
> Is my interpretation of the docs off or is the implementation of AUTO  
> inconsistent with the docs?

to make the implicit question of my original post more explicit: How can I  
achieve the documented behavior of fuzziness: "AUTO", i.e. a fuzzy search  
that allows zero edits in terms of length one, one edit in terms of length

> = two and two edits only in terms of length five and above?

Cheers,  
David

--  
You received this message because you are subscribed to the Google Groups "elasticsearch" group.  
To unsubscribe from this group and stop receiving emails from it, send an email to [elasticsearch+unsubscribe@googlegroups.com](mailto:elasticsearch+unsubscribe@googlegroups.com).  
To view this discussion on the web visit [https://groups.google.com/d/msgid/elasticsearch/8e10c0c9-9a77-4214-a406-5c329249c85a%40googlegroups.com](https://groups.google.com/d/msgid/elasticsearch/8e10c0c9-9a77-4214-a406-5c329249c85a%40googlegroups.com).  
For more options, visit [https://groups.google.com/d/optout](https://groups.google.com/d/optout).

---

<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:59am UTC](https://discuss.elastic.co/t/fuzziness-auto-doesnt-work-as-expected/19982/3 "2017-07-06T00:59:24Z")

</div>


