Understand fuzzy and how it works

I indexed document with field customerID : user123 and user1234 and I ran
below queries and got different results. I understand the concept of fuzzy
but what I am interested in knowing is that how does elasticsearch store it
internally that it's able to retrieve user1234 when I use a fuzzy query:

Match Query returns only user123.

[root@ip-10-80-140-242 ~]# ./match.e
{
"took" : 2,
"timed_out" : false,
"_shards" : {
"total" : 1,
"successful" : 1,
"failed" : 0
},
"hits" : {
"total" : 2,
"max_score" : 1.287682,
"hits" : [ {
"_index" : "test1",
"_type" : "test",
"_id" : "3jreFivbT1CsrohoSjSDuw",
"_score" : 1.287682, "_source" :
{
"productName":"sample",
"customerID":"user123"
}
}, {
"_index" : "test1",
"_type" : "test",
"_id" : "_Rfj0pPpSbWN5a72PVt1cQ",
"_score" : 1.287682, "_source" :
{
"productName":"sample",
"customerID":"user123"
}
} ]
}
}

Fuzzy Query with "text_like_this returns user1234:

[root@ip-10-80-140-242 ~]# ./fuzzy.e
{
"took" : 3,
"timed_out" : false,
"_shards" : {
"total" : 1,
"successful" : 1,
"failed" : 0
},
"hits" : {
"total" : 4,
"max_score" : 0.9426194,
"hits" : [ {
"_index" : "test1",
"_type" : "test",
"_id" : "3jreFivbT1CsrohoSjSDuw",
"_score" : 0.9426194, "_source" :
{
"productName":"sample",
"customerID":"user123"
}
}, {
"_index" : "test1",
"_type" : "test",
"_id" : "_Rfj0pPpSbWN5a72PVt1cQ",
"_score" : 0.9426194, "_source" :
{
"productName":"sample",
"customerID":"user123"
}
}, {
"_index" : "test1",
"_type" : "test",
"_id" : "KzAHVe6fQNu9SsJVMVFK7A",
"_score" : 0.48092827, "_source" :
{
"productName":"sample",
"customerID":"user1234"
}
}, {
"_index" : "test1",
"_type" : "test",
"_id" : "nKAQjw0dSyqjFllDV9Z9iQ",
"_score" : 0.38474262, "_source" :
{
"productName":"sample name",
"customerID":"user1234"
}
} ]
}
}

[root@ip-10-80-140-242 ~]# cat fuzzy.e

curl -XGET 'http://localhost:9200/test1/test/_search?pretty=true' -d '{

"query" : {

"fuzzy_like_this" : {

"customerID" : {

"like_text" : "user123"

}

}

}

}'

[root@ip-10-80-140-242 ~]# cat match.e

curl -XGET 'http://localhost:9200/test1/test/_search?pretty=true' -d '{

"query" : {

"match" : {

"customerID" : "user123"

}

}

}'

--
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.
For more options, visit https://groups.google.com/groups/opt_out.