# Confusing results from fuzzy query (1 term, 1 field)

**URL:** <https://discuss.elastic.co/t/confusing-results-from-fuzzy-query-1-term-1-field/21843>\
**Category:** Elasticsearch\
**Created:** [January 27, 2015, 12:54am UTC](https://discuss.elastic.co/t/confusing-results-from-fuzzy-query-1-term-1-field/21843 "2015-01-27T00:54:47Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![Steve\_Pearlman](https://avatars.discourse-cdn.com/v4/letter/s/d07c76/32.png) [@Steve\_Pearlman](https://discuss.elastic.co/u/Steve_Pearlman)\
**Post date:** [January 27, 2015, 12:54am UTC](https://discuss.elastic.co/t/confusing-results-from-fuzzy-query-1-term-1-field/21843/1 "2015-01-27T00:54:47Z")

</div>

For a well formatted example, please  
see: [http://stackoverflow.com/questions/28161480/fuzzy-not-functioning-as-expected-one-term-search-see-example](http://stackoverflow.com/questions/28161480/fuzzy-not-functioning-as-expected-one-term-search-see-example)

Here's my problem:  
Consider the following results from:

```
curl -XGET 'http://localhost:9200/megacorp/employee/_search' -d 
'{ "query" : 
     {"match":  
        {"last_name": "Smith"}
     }
  }'

```

Result:

```
{
  "took": 3,
  "timed_out": false,
  "_shards": {
    "total": 5,
    "successful": 5,
    "failed": 0
  },
  "hits": {
    "total": 2,
    "max_score": 0.30685282,
    "hits": [
      {
        "_index": "megacorp",
        "_type": "employee",
        "_id": "1",
        "_score": 0.30685282,
        "_source": {
          "first_name": "John",
          "last_name": "Smith",
          "age": 25,
          "about": "I love to go rock climbing on the weekends.",
          "interests": [
            "sports",
            "music"
          ]
        }
      },
      {
        "_index": "megacorp",
        "_type": "employee",
        "_id": "2",
        "_score": 0.30685282,
        "_source": {
          "first_name": "Jane",
          "last_name": "Smith",
          "age": 25,
          "about": "I love to go rock climbing",
          "interests": [
            "sports",
            "music"
          ]
        }
      }
    ]
  }
}

```

Now when I execute the following query:

```
curl -XGET 'http://localhost:9200/megacorp/employee/_search' -d 
'{ "query" : 
        {"fuzzy": 
             {"last_name": 
                  {"value":"Smitt", 
                   "fuzziness": 1
                  }
              }
         }
 }'

```

Returns NO results despite the Levenshtein distance of "Smith" and "Smitt"  
being 1. The same thing happens with a value of "Smit," (NB: the comma is  
for grammatical purposes, it's not in the value) which also has a distance  
of 1. If I put in a `fuzziness` value of 2, I get results. What am I  
missing here?

--  
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/0fe765b1-1bda-4459-8ee5-aeddc9f05727%40googlegroups.com](https://groups.google.com/d/msgid/elasticsearch/0fe765b1-1bda-4459-8ee5-aeddc9f05727%40googlegroups.com).  
For more options, visit [https://groups.google.com/d/optout](https://groups.google.com/d/optout).

---

<div class="post-metadata">

**Author:** ![mikemccand](https://avatars.discourse-cdn.com/v4/letter/m/f04885/32.png) [@mikemccand](https://discuss.elastic.co/u/mikemccand)\
**Post date:** [January 27, 2015, 11:41am UTC](https://discuss.elastic.co/t/confusing-results-from-fuzzy-query-1-term-1-field/21843/2 "2015-01-27T11:41:48Z")

</div>

Looks like this was answered on StackOverflow?

Mike McCandless

[http://blog.mikemccandless.com](http://blog.mikemccandless.com)

On Mon, Jan 26, 2015 at 7:54 PM, Steve Pearlman [slpearlman@gmail.com](mailto:slpearlman@gmail.com)  
wrote:

> For a well formatted example, please see:  
> [elasticsearch - Fuzzy not functioning as expected (one term search, see example) - Stack Overflow](http://stackoverflow.com/questions/28161480/fuzzy-not-functioning-as-expected-one-term-search-see-example)
> 
> Here's my problem:  
> Consider the following results from:
> 
> ```
> curl -XGET 'http://localhost:9200/megacorp/employee/_search' -d
> '{ "query" :
> {"match":
> {"last_name": "Smith"}
> }
> }'
> 
> ```
> 
> Result:
> 
> ```
> {
> "took": 3,
> "timed_out": false,
> "_shards": {
> "total": 5,
> "successful": 5,
> "failed": 0
> },
> "hits": {
> "total": 2,
> "max_score": 0.30685282,
> "hits": [
> {
> "_index": "megacorp",
> "_type": "employee",
> "_id": "1",
> "_score": 0.30685282,
> "_source": {
> "first_name": "John",
> "last_name": "Smith",
> "age": 25,
> "about": "I love to go rock climbing on the weekends.",
> "interests": [
> "sports",
> "music"
> ]
> }
> },
> {
> "_index": "megacorp",
> "_type": "employee",
> "_id": "2",
> "_score": 0.30685282,
> "_source": {
> "first_name": "Jane",
> "last_name": "Smith",
> "age": 25,
> "about": "I love to go rock climbing",
> "interests": [
> "sports",
> "music"
> ]
> }
> }
> ]
> }
> }
> 
> ```
> 
> Now when I execute the following query:
> 
> ```
> curl -XGET 'http://localhost:9200/megacorp/employee/_search' -d
> '{ "query" :
> {"fuzzy":
> {"last_name":
> {"value":"Smitt",
> "fuzziness": 1
> }
> }
> }
> }'
> 
> ```
> 
> Returns NO results despite the Levenshtein distance of "Smith" and "Smitt"  
> being 1. The same thing happens with a value of "Smit," (NB: the comma is  
> for grammatical purposes, it's not in the value) which also has a distance  
> of 1. If I put in a `fuzziness` value of 2, I get results. What am I  
> missing here?
> 
> --  
> 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/0fe765b1-1bda-4459-8ee5-aeddc9f05727%40googlegroups.com](https://groups.google.com/d/msgid/elasticsearch/0fe765b1-1bda-4459-8ee5-aeddc9f05727%40googlegroups.com)  
> [https://groups.google.com/d/msgid/elasticsearch/0fe765b1-1bda-4459-8ee5-aeddc9f05727%40googlegroups.com?utm\_medium=email&utm\_source=footer](https://groups.google.com/d/msgid/elasticsearch/0fe765b1-1bda-4459-8ee5-aeddc9f05727%40googlegroups.com?utm_medium=email&utm_source=footer)  
> .  
> For more options, visit [https://groups.google.com/d/optout](https://groups.google.com/d/optout).

--  
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/CAD7smRe5cXGF\_FesNGOxS4294c2yq8oagmqZ%2BxKYjKv1\_wO5kw%40mail.gmail.com](https://groups.google.com/d/msgid/elasticsearch/CAD7smRe5cXGF_FesNGOxS4294c2yq8oagmqZ%2BxKYjKv1_wO5kw%40mail.gmail.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:36am UTC](https://discuss.elastic.co/t/confusing-results-from-fuzzy-query-1-term-1-field/21843/3 "2017-07-06T00:36:27Z")

</div>


