# \`max\_errors\` clarification - its use and purpose

**URL:** https://discuss.elastic.co/t/max-errors-clarification-its-use-and-purpose/51810
**Category:** Elasticsearch
**Created:** [June 3, 2016, 3:56pm UTC](https://discuss.elastic.co/t/max-errors-clarification-its-use-and-purpose/51810 "2016-06-03T15:56:05Z")
**Posts on this page:** 3
**Page:** 1

<div class="post-metadata">

### Author: ![Imran\_Azad](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/imran_azad/32/4394_2.png) [@Imran\_Azad](https://discuss.elastic.co/u/Imran_Azad)
#### Post date: [June 3, 2016, 3:56pm UTC](https://discuss.elastic.co/t/max-errors-clarification-its-use-and-purpose/51810/1 "2016-06-03T15:56:05Z")

</div>

I want to clarify the purpose of max\_errors I understand that it is an option to specify the number of erroneous terms in a given phrase. In my use case, I would always want all terms to be corrected so for example:

paracetmol tummour CLODRoONATE

If I specify max\_errors as 2 I get the following output:

"suggest": {  
"phrase": [  
{  
"text": "paracetmol tummour CLODRoONATE",  
"offset": 0,  
"length": 30,  
"options": [  
{  
"text": "paracetamol tumour clodroonate",  
"highlighted": "_paracetamol tumour_ clodroonate",  
"score": 0.0000011286303  
},  
{  
"text": "paracetmol tumour clodronate",  
"highlighted": "paracetmol _tumour clodronate_",  
"score": 3.56549e-7  
},  
{  
"text": "paracetmol tumour clodroonate",  
"highlighted": "paracetmol _tumour_ clodroonate",  
"score": 1.8145049e-7  
},  
{  
"text": "paracetamol tummour clodronate",  
"highlighted": "_paracetamol_ tummour _clodronate_",  
"score": 1.7691919e-7  
},  
{  
"text": "paracetamol tummour clodroonate",  
"highlighted": "_paracetamol_ tummour clodroonate",  
"score": 9.003551e-8  
}  
]  
}  
]  
}  
}  
However I would always want as many terms to be corrected as possible so in this instance I would specify 3, since a query string can be any number in length, I'm planning on setting this to a large number such as 200 to ensure as many terms are corrected as possible. So the question is what exactly is the purpose of max\_errors why would you want to set a limit on it? Perhaps I'm misunderstanding its purpose of what it is intended for.

---

<div class="post-metadata">

### Author: ![Mark\_Harwood](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/mark_harwood/32/10538_2.png) [@Mark\_Harwood](https://discuss.elastic.co/u/Mark_Harwood)
#### Post date: [June 3, 2016, 4:23pm UTC](https://discuss.elastic.co/t/max-errors-clarification-its-use-and-purpose/51810/2 "2016-06-03T16:23:05Z")

</div>

> [@Imran\_Azad](#):
>
> since a query string can be any number in length, I'm planning on setting this to a large number such as 200

If it is set to a fraction (ie \>0 and \<1) rather than a number \>=1 then it acts a percentage of the provided terms.

> [@Imran\_Azad](#):
>
> why would you want to set a limit on it?

The docs [1] warn of a performance hit but I presume it might also mean that you have suggestions that aren't remotely close to what the user typed.

[1] [Phrase Suggester | Elasticsearch Guide [2.3] | Elastic](https://www.elastic.co/guide/en/elasticsearch/reference/2.3/search-suggesters-phrase.html#_basic_phrase_suggest_api_parameters)

---

<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 5, 2017, 10:46pm UTC](https://discuss.elastic.co/t/max-errors-clarification-its-use-and-purpose/51810/3 "2017-07-05T22:46:22Z")

</div>


