# How to get results for missspelled query not using fuzzy based query?

**URL:** <https://discuss.elastic.co/t/how-to-get-results-for-missspelled-query-not-using-fuzzy-based-query/3876>\
**Category:** Elasticsearch\
**Created:** [February 3, 2011, 1:43pm UTC](https://discuss.elastic.co/t/how-to-get-results-for-missspelled-query-not-using-fuzzy-based-query/3876 "2011-02-03T13:43:28Z")\
**Posts on this page:** 9\
**Page:** 1

<div class="post-metadata">

**Author:** ![Michal\_Orzechowski](https://avatars.discourse-cdn.com/v4/letter/m/258eb7/32.png) [@Michal\_Orzechowski](https://discuss.elastic.co/u/Michal_Orzechowski)\
**Post date:** [February 3, 2011, 1:43pm UTC](https://discuss.elastic.co/t/how-to-get-results-for-missspelled-query-not-using-fuzzy-based-query/3876/1 "2011-02-03T13:43:28Z")

</div>

Hi,

I am new to ElasticSearch and I am trying to handel such a case:

I have indexed a products:

curl -XPUT '[http://localhost:9200/shop/cameras/1](http://localhost:9200/shop/cameras/1)' -d '  
{  
"product\_name": "Digital SLR Camera Nikon D3100 14.2MP"  
}  
'

curl -XPUT '[http://localhost:9200/shop/cameras/2](http://localhost:9200/shop/cameras/2)' -d '  
{  
"product\_name": "Camera Nikon D60 10.2MP"  
}  
'

and I am trying to get them when the query is misspelled. It works quite  
fine for fuzzy based query like:

curl -XGET '[http://localhost:9200/shop/cameras/\_search](http://localhost:9200/shop/cameras/_search)' -d '  
{  
"query" : {  
"fuzzy" : {  
"product\_name" : {  
"value" : "nikko",  
"min\_similarity" : 0.5  
}  
}  
}  
}  
'  
However in docs for fuzzy based query there is a warrning that this  
solution is not scalable. Is there another way to get results for  
misspeled query  
not using fuzzy based queries?

Thanks in advance.  
Michal

---

<div class="post-metadata">

**Author:** ![Karussell1](https://avatars.discourse-cdn.com/v4/letter/k/50afbb/32.png) [@Karussell1](https://discuss.elastic.co/u/Karussell1)\
**Post date:** [February 4, 2011, 11:50pm UTC](https://discuss.elastic.co/t/how-to-get-results-for-missspelled-query-not-using-fuzzy-based-query/3876/2 "2011-02-04T23:50:35Z")

</div>

You could try to create your own analyzer (or take one from Solr ;))  
Either via n-grams or 'phonetic terms' - terms that sounds equally  
will get the same transformed term: see [Soundex - Wikipedia](http://en.wikipedia.org/wiki/Soundex)  
etc

Another start could be to look at Solr's spellchecking mechanism and  
copy them to use the (analyzer) into ES 😉

[http://wiki.apache.org/solr/SpellCheckComponent](http://wiki.apache.org/solr/SpellCheckComponent)

On the other side I would try fuzzy or at least if no results were  
returned query the index via fuzzy (in background) ...

Regards,  
Peter.

On 3 Feb., 14:43, Michał Orzechowski [michal.orzechow...@nokaut.pl](mailto:michal.orzechow...@nokaut.pl)  
wrote:

> Hi,
> 
> I am new to Elasticsearch and I am trying to handel such a case:
> 
> I have indexed a products:
> 
> curl -XPUT '[http://localhost:9200/shop/cameras/1'-d](http://localhost:9200/shop/cameras/1'-d) '  
> {  
> "product\_name": "Digital SLR Camera Nikon D3100 14.2MP"}
> 
> '
> 
> curl -XPUT '[http://localhost:9200/shop/cameras/2'-d](http://localhost:9200/shop/cameras/2'-d) '  
> {  
> "product\_name": "Camera Nikon D60 10.2MP"}
> 
> '
> 
> and I am trying to get them when the query is misspelled. It works quite  
> fine for fuzzy based query like:
> 
> curl -XGET '[http://localhost:9200/shop/cameras/\_search'-d](http://localhost:9200/shop/cameras/_search'-d) '  
> {  
> "query" : {  
> "fuzzy" : {  
> "product\_name" : {  
> "value" : "nikko",  
> "min\_similarity" : 0.5  
> }  
> }  
> }}
> 
> '  
> However in docs for fuzzy based query there is a warrning that this  
> solution is not scalable. Is there another way to get results for  
> misspeled query  
> not using fuzzy based queries?
> 
> Thanks in advance.  
> Michal

---

<div class="post-metadata">

**Author:** ![Karussell1](https://avatars.discourse-cdn.com/v4/letter/k/50afbb/32.png) [@Karussell1](https://discuss.elastic.co/u/Karussell1)\
**Post date:** [February 4, 2011, 11:51pm UTC](https://discuss.elastic.co/t/how-to-get-results-for-missspelled-query-not-using-fuzzy-based-query/3876/3 "2011-02-04T23:51:43Z")

</div>

also take a look here:

[http://elasticsearch-users.115913.n3.nabble.com/Terms-API-for-Spellchecker-td1691838.html](http://elasticsearch-users.115913.n3.nabble.com/Terms-API-for-Spellchecker-td1691838.html)

On 5 Feb., 00:50, Karussell [tableyourt...@googlemail.com](mailto:tableyourt...@googlemail.com) wrote:

> You could try to create your own analyzer (or take one from Solr ;))  
> Either via n-grams or 'phonetic terms' - terms that sounds equally  
> will get the same transformed term: seehttp://en.wikipedia.org/wiki/Soundex  
> etc
> 
> Another start could be to look at Solr's spellchecking mechanism and  
> copy them to use the (analyzer) into ES 😉
> 
> [SpellCheckComponent - Solr - Apache Software Foundation](http://wiki.apache.org/solr/SpellCheckComponent)
> 
> On the other side I would try fuzzy or at least if no results were  
> returned query the index via fuzzy (in background) ...
> 
> Regards,  
> Peter.
> 
> On 3 Feb., 14:43, Michał Orzechowski [michal.orzechow...@nokaut.pl](mailto:michal.orzechow...@nokaut.pl)  
> wrote:
> 
> > Hi,
> 
> > I am new to Elasticsearch and I am trying to handel such a case:
> 
> > I have indexed a products:
> 
> > curl -XPUT '[http://localhost:9200/shop/cameras/1'-d'](http://localhost:9200/shop/cameras/1'-d')  
> > {  
> > "product\_name": "Digital SLR Camera Nikon D3100 14.2MP"}
> 
> > '
> 
> > curl -XPUT '[http://localhost:9200/shop/cameras/2'-d'](http://localhost:9200/shop/cameras/2'-d')  
> > {  
> > "product\_name": "Camera Nikon D60 10.2MP"}
> 
> > '
> 
> > and I am trying to get them when the query is misspelled. It works quite  
> > fine for fuzzy based query like:
> 
> > curl -XGET '[http://localhost:9200/shop/cameras/\_search'-d'](http://localhost:9200/shop/cameras/_search'-d')  
> > {  
> > "query" : {  
> > "fuzzy" : {  
> > "product\_name" : {  
> > "value" : "nikko",  
> > "min\_similarity" : 0.5  
> > }  
> > }  
> > }}
> 
> > '  
> > However in docs for fuzzy based query there is a warrning that this  
> > solution is not scalable. Is there another way to get results for  
> > misspeled query  
> > not using fuzzy based queries?
> 
> > Thanks in advance.  
> > Michal

---

<div class="post-metadata">

**Author:** ![Michal\_Orzechowski](https://avatars.discourse-cdn.com/v4/letter/m/258eb7/32.png) [@Michal\_Orzechowski](https://discuss.elastic.co/u/Michal_Orzechowski)\
**Post date:** [February 8, 2011, 12:53pm UTC](https://discuss.elastic.co/t/how-to-get-results-for-missspelled-query-not-using-fuzzy-based-query/3876/4 "2011-02-08T12:53:02Z")

</div>

Thanks for help! I am going to look into those Solr components.

On 5 Lut, 00:51, Karussell [tableyourt...@googlemail.com](mailto:tableyourt...@googlemail.com) wrote:

> also take a look here:
> 
> [http://elasticsearch-users.115913.n3.nabble.com/Terms-API-for-Spellch](http://elasticsearch-users.115913.n3.nabble.com/Terms-API-for-Spellch)...
> 
> On 5 Feb., 00:50, Karussell [tableyourt...@googlemail.com](mailto:tableyourt...@googlemail.com) wrote:
> 
> > You could try to create your own analyzer (or take one from Solr ;))  
> > Either via n-grams or 'phonetic terms' - terms that sounds equally  
> > will get the same transformed term: seehttp://en.wikipedia.org/wiki/Soundex  
> > etc
> 
> > Another start could be to look at Solr's spellchecking mechanism and  
> > copy them to use the (analyzer) into ES 😉
> 
> > [SpellCheckComponent - Solr - Apache Software Foundation](http://wiki.apache.org/solr/SpellCheckComponent)
> 
> > On the other side I would try fuzzy or at least if no results were  
> > returned query the index via fuzzy (in background) ...
> 
> > Regards,  
> > Peter.
> 
> > On 3 Feb., 14:43, Michał Orzechowski [michal.orzechow...@nokaut.pl](mailto:michal.orzechow...@nokaut.pl)  
> > wrote:
> 
> > > Hi,
> 
> > > I am new to Elasticsearch and I am trying to handel such a case:
> 
> > > I have indexed a products:
> 
> > > curl -XPUT '[http://localhost:9200/shop/cameras/1'-d'](http://localhost:9200/shop/cameras/1'-d')  
> > > {  
> > > "product\_name": "Digital SLR Camera Nikon D3100 14.2MP"}
> 
> > > '
> 
> > > curl -XPUT '[http://localhost:9200/shop/cameras/2'-d'](http://localhost:9200/shop/cameras/2'-d')  
> > > {  
> > > "product\_name": "Camera Nikon D60 10.2MP"}
> 
> > > '
> 
> > > and I am trying to get them when the query is misspelled. It works quite  
> > > fine for fuzzy based query like:
> 
> > > curl -XGET '[http://localhost:9200/shop/cameras/\_search'-d'](http://localhost:9200/shop/cameras/_search'-d')  
> > > {  
> > > "query" : {  
> > > "fuzzy" : {  
> > > "product\_name" : {  
> > > "value" : "nikko",  
> > > "min\_similarity" : 0.5  
> > > }  
> > > }  
> > > }}
> 
> > > '  
> > > However in docs for fuzzy based query there is a warrning that this  
> > > solution is not scalable. Is there another way to get results for  
> > > misspeled query  
> > > not using fuzzy based queries?
> 
> > > Thanks in advance.  
> > > Michal

---

<div class="post-metadata">

**Author:** ![kimchy](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/kimchy/32/44952_2.png) [@kimchy](https://discuss.elastic.co/u/kimchy)\
**Post date:** [February 8, 2011, 2:22pm UTC](https://discuss.elastic.co/t/how-to-get-results-for-missspelled-query-not-using-fuzzy-based-query/3876/5 "2011-02-08T14:22:51Z")

</div>

Those analyzers are already provided in ES (soundex and ngram). Regarding the spell check component, it is problematic since it requires another index to be built alongside the original index, which gets really complicated when it comes to distributed system.

The reason for not tackling this currently is that there is a really cool work done in lucene trunk (upcoming 4.0) that will provide spell check like functionality while working on the original index.  
On Tuesday, February 8, 2011 at 2:53 PM, MichaÅ Orzechowski wrote:

> Thanks for help! I am going to look into those Solr components.
> 
> On 5 Lut, 00:51, Karussell [tableyourt...@googlemail.com](mailto:tableyourt...@googlemail.com) wrote:
> 
> > also take a look here:
> > 
> > [http://elasticsearch-users.115913.n3.nabble.com/Terms-API-for-Spellch](http://elasticsearch-users.115913.n3.nabble.com/Terms-API-for-Spellch)...
> > 
> > On 5 Feb., 00:50, Karussell [tableyourt...@googlemail.com](mailto:tableyourt...@googlemail.com) wrote:
> > 
> > > You could try to create your own analyzer (or take one from Solr ;))  
> > > Either via n-grams or 'phonetic terms' - terms that sounds equally  
> > > will get the same transformed term: seehttp://en.wikipedia.org/wiki/Soundex  
> > > etc
> > 
> > > Another start could be to look at Solr's spellchecking mechanism and  
> > > copy them to use the (analyzer) into ES 😉
> > 
> > > [SpellCheckComponent - Solr - Apache Software Foundation](http://wiki.apache.org/solr/SpellCheckComponent)
> > 
> > > On the other side I would try fuzzy or at least if no results were  
> > > returned query the index via fuzzy (in background) ...
> > 
> > > Regards,  
> > > Peter.
> > 
> > > On 3 Feb., 14:43, MichaÅ Orzechowski [michal.orzechow...@nokaut.pl](mailto:michal.orzechow...@nokaut.pl)  
> > > wrote:
> > 
> > > > Hi,
> > 
> > > > I am new to Elasticsearch and I am trying to handel such a case:
> > 
> > > > I have indexed a products:
> > 
> > > > curl -XPUT '[http://localhost:9200/shop/cameras/1'-d'](http://localhost:9200/shop/cameras/1'-d')  
> > > > {  
> > > > "product\_name": "Digital SLR Camera Nikon D3100 14.2MP"}
> > 
> > > > '
> > 
> > > > curl -XPUT '[http://localhost:9200/shop/cameras/2'-d'](http://localhost:9200/shop/cameras/2'-d')  
> > > > {  
> > > > "product\_name": "Camera Nikon D60 10.2MP"}
> > 
> > > > '
> > 
> > > > and I am trying to get them when the query is misspelled. It works quite  
> > > > fine for fuzzy based query like:
> > 
> > > > curl -XGET '[http://localhost:9200/shop/cameras/\_search'-d'](http://localhost:9200/shop/cameras/_search'-d')  
> > > > {  
> > > > "query" : {  
> > > > "fuzzy" : {  
> > > > "product\_name" : {  
> > > > "value" : "nikko",  
> > > > "min\_similarity" : 0.5  
> > > > }  
> > > > }  
> > > > }}
> > 
> > > > '  
> > > > However in docs for fuzzy based query there is a warrning that this  
> > > > solution is not scalable. Is there another way to get results for  
> > > > misspeled query  
> > > > not using fuzzy based queries?
> > 
> > > > Thanks in advance.  
> > > > Michal

---

<div class="post-metadata">

**Author:** ![srrin](https://avatars.discourse-cdn.com/v4/letter/s/85f322/32.png) [@srrin](https://discuss.elastic.co/u/srrin)\
**Post date:** [April 22, 2011, 5:53am UTC](https://discuss.elastic.co/t/how-to-get-results-for-missspelled-query-not-using-fuzzy-based-query/3876/6 "2011-04-22T05:53:13Z")

</div>

Hi Shay,  
Is there any example on how to use this phonetic analyzers and search documents?  
This may help to implement one of my clients request.

---

<div class="post-metadata">

**Author:** ![kimchy](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/kimchy/32/44952_2.png) [@kimchy](https://discuss.elastic.co/u/kimchy)\
**Post date:** [April 28, 2011, 9:44pm UTC](https://discuss.elastic.co/t/how-to-get-results-for-missspelled-query-not-using-fuzzy-based-query/3876/7 "2011-04-28T21:44:41Z")

</div>

This page has an example of how to set it up: [Elasticsearch Platform — Find real-time answers at scale | Elastic](http://www.elasticsearch.org/guide/reference/index-modules/analysis/phonetic-tokenfilter.html). Then, you can reference the constructed analyzer by name in your mappings (where it applies).  
On Friday, April 22, 2011 at 8:53 AM, srrIN wrote:

> Hi Shay,  
> Is there any example on how to use this phonetic analyzers and search  
> documents?  
> This may help to implement one of my clients request.
> 
> --  
> View this message in context: [http://elasticsearch-users.115913.n3.nabble.com/How-to-get-results-for-missspelled-query-not-using-fuzzy-based-query-tp2413584p2850491.html](http://elasticsearch-users.115913.n3.nabble.com/How-to-get-results-for-missspelled-query-not-using-fuzzy-based-query-tp2413584p2850491.html)  
> Sent from the Elasticsearch Users mailing list archive at [Nabble.com](http://Nabble.com).

---

<div class="post-metadata">

**Author:** ![srrin](https://avatars.discourse-cdn.com/v4/letter/s/85f322/32.png) [@srrin](https://discuss.elastic.co/u/srrin)\
**Post date:** [April 30, 2011, 3:15pm UTC](https://discuss.elastic.co/t/how-to-get-results-for-missspelled-query-not-using-fuzzy-based-query/3876/8 "2011-04-30T15:15:12Z")

</div>

Thank you, will check with this and get back to you for any clarifications.

- SRR

---

<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, 4:07am UTC](https://discuss.elastic.co/t/how-to-get-results-for-missspelled-query-not-using-fuzzy-based-query/3876/9 "2017-07-06T04:07:15Z")

</div>


