# How to get multiple corrections with phrase suggester?

**URL:** <https://discuss.elastic.co/t/how-to-get-multiple-corrections-with-phrase-suggester/16094>\
**Category:** Elasticsearch\
**Created:** [March 3, 2014, 2:28am UTC](https://discuss.elastic.co/t/how-to-get-multiple-corrections-with-phrase-suggester/16094 "2014-03-03T02:28:30Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![Alexey\_Kotlyarov](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/alexey_kotlyarov/32/1386_2.png) [@Alexey\_Kotlyarov](https://discuss.elastic.co/u/Alexey_Kotlyarov)\
**Post date:** [March 3, 2014, 2:28am UTC](https://discuss.elastic.co/t/how-to-get-multiple-corrections-with-phrase-suggester/16094/1 "2014-03-03T02:28:30Z")

</div>

I want to correct multiple terms in a phrase at a time using the phrase  
suggester. However, ES only suggests changing one _or_ the other, and not  
both.

My setup: [https://www.found.no/play/gist/9316842](https://www.found.no/play/gist/9316842)

Data:  
[  
{ "value": "broken" },  
{ "value": "problem" }  
]

Query:

```
{
    "suggest": {
        "text": "braken prablem",
        "simple_phrase": {
            "phrase": {
                "field": "value"
            }
        }
    },
    "size": 0
}

```

I get back "braken problem" and "broken prablem". How do I reformulate the  
query so I get the expected "broken problem"?

--  
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/c60a821d-e6c4-4196-814b-0a90dd731880%40googlegroups.com](https://groups.google.com/d/msgid/elasticsearch/c60a821d-e6c4-4196-814b-0a90dd731880%40googlegroups.com).  
For more options, visit [https://groups.google.com/groups/opt\_out](https://groups.google.com/groups/opt_out).

---

<div class="post-metadata">

**Author:** ![nik9000](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/nik9000/32/44947_2.png) [@nik9000](https://discuss.elastic.co/u/nik9000)\
**Post date:** [March 3, 2014, 3:08am UTC](https://discuss.elastic.co/t/how-to-get-multiple-corrections-with-phrase-suggester/16094/2 "2014-03-03T03:08:10Z")

</div>

Set max\_errors to 2. Numbers greater than two can get quite slow so try to  
stick with 1 or 2.

On Sun, Mar 2, 2014 at 9:28 PM, Alexey Kotlyarov [koterpillar@gmail.com](mailto:koterpillar@gmail.com)wrote:

> I want to correct multiple terms in a phrase at a time using the phrase  
> suggester. However, ES only suggests changing one _or_ the other, and not  
> both.
> 
> My setup: [https://www.found.no/play/gist/9316842](https://www.found.no/play/gist/9316842)
> 
> Data:  
> [  
> { "value": "broken" },  
> { "value": "problem" }  
> ]
> 
> Query:
> 
> ```
> {
> "suggest": {
> "text": "braken prablem",
> "simple_phrase": {
> "phrase": {
> "field": "value"
> }
> }
> },
> "size": 0
> }
> 
> ```
> 
> I get back "braken problem" and "broken prablem". How do I reformulate the  
> query so I get the expected "broken problem"?
> 
> --  
> 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/c60a821d-e6c4-4196-814b-0a90dd731880%40googlegroups.com](https://groups.google.com/d/msgid/elasticsearch/c60a821d-e6c4-4196-814b-0a90dd731880%40googlegroups.com)[https://groups.google.com/d/msgid/elasticsearch/c60a821d-e6c4-4196-814b-0a90dd731880%40googlegroups.com?utm\_medium=email&utm\_source=footer](https://groups.google.com/d/msgid/elasticsearch/c60a821d-e6c4-4196-814b-0a90dd731880%40googlegroups.com?utm_medium=email&utm_source=footer)  
> .  
> For more options, visit [https://groups.google.com/groups/opt\_out](https://groups.google.com/groups/opt_out).

--  
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/CAPmjWd2av98ZsknKqPvpWes3Sws7h6Y-3C4F4QC3tKhqkmvYTA%40mail.gmail.com](https://groups.google.com/d/msgid/elasticsearch/CAPmjWd2av98ZsknKqPvpWes3Sws7h6Y-3C4F4QC3tKhqkmvYTA%40mail.gmail.com).  
For more options, visit [https://groups.google.com/groups/opt\_out](https://groups.google.com/groups/opt_out).

---

<div class="post-metadata">

**Author:** ![Alexey\_Kotlyarov](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/alexey_kotlyarov/32/1386_2.png) [@Alexey\_Kotlyarov](https://discuss.elastic.co/u/Alexey_Kotlyarov)\
**Post date:** [March 4, 2014, 12:25am UTC](https://discuss.elastic.co/t/how-to-get-multiple-corrections-with-phrase-suggester/16094/3 "2014-03-04T00:25:23Z")

</div>

No luck: now I've run into inconsistency between found.no and my own  
instance.

Here's the updated  
fiddle: [https://www.found.no/play/gist/a9b668ffd8019a73cb00](https://www.found.no/play/gist/a9b668ffd8019a73cb00)

And here's my own attempt to reproduce:

curl -XDELETE [http://localhost:9200/zzzz](http://localhost:9200/zzzz)  
curl -XPUT [http://localhost:9200/zzzz/yyyy/1](http://localhost:9200/zzzz/yyyy/1) -d '{"value": "broken"}'  
curl -XPUT [http://localhost:9200/zzzz/yyyy/2](http://localhost:9200/zzzz/yyyy/2) -d '{"value": "problem"}'  
curl -XPOST [http://localhost:9200/zzzz/\_refresh](http://localhost:9200/zzzz/_refresh)  
curl -XPOST '[http://localhost:9200/zzzz/yyyy/\_search?pretty=1](http://localhost:9200/zzzz/yyyy/_search?pretty=1)' -d '{  
"suggest": {  
"text": "borken porblem",  
"simple\_phrase": {  
"phrase": {  
"field": "value",  
"max\_errors": 3,  
"size": 100  
}  
}  
},  
"size": 0  
}'

found.no returns the following options (with scores):  
"broken problem": 0.47322324  
"borken problem": 0.37071815  
"broken porblem": 0.36621025

My own instance:  
"borken problem": 0.6768855  
"broken porblem": 0.6686546

Why are the scores different? Why do the results differ? How do I get the  
"broken problem" (and, ideally, no other suggestions)?

--  
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/defc99f7-c765-42c3-8587-0d74d55aec9f%40googlegroups.com](https://groups.google.com/d/msgid/elasticsearch/defc99f7-c765-42c3-8587-0d74d55aec9f%40googlegroups.com).  
For more options, visit [https://groups.google.com/groups/opt\_out](https://groups.google.com/groups/opt_out).

---

<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, 1:45am UTC](https://discuss.elastic.co/t/how-to-get-multiple-corrections-with-phrase-suggester/16094/4 "2017-07-06T01:45:57Z")

</div>


