# Elasticsearch complete suggestion is showing only half sentence, why?

**URL:** <https://discuss.elastic.co/t/elasticsearch-complete-suggestion-is-showing-only-half-sentence-why/136297>\
**Category:** Elasticsearch\
**Created:** [June 18, 2018, 11:33am UTC](https://discuss.elastic.co/t/elasticsearch-complete-suggestion-is-showing-only-half-sentence-why/136297 "2018-06-18T11:33:01Z")\
**Posts on this page:** 7\
**Page:** 1

<div class="post-metadata">

**Author:** ![rs123](https://avatars.discourse-cdn.com/v4/letter/r/73ab20/32.png) [@rs123](https://discuss.elastic.co/u/rs123)\
**Post date:** [June 18, 2018, 11:33am UTC](https://discuss.elastic.co/t/elasticsearch-complete-suggestion-is-showing-only-half-sentence-why/136297/1 "2018-06-18T11:33:02Z")

</div>

Mapping:

> PUT movies  
> {  
> "mappings": {  
> "marvels": {  
> "properties": {  
> "name": {  
> "type": "completion"  
> },  
> "year": {  
> "type": "keyword"  
> }  
> }  
> }  
> }  
> }

Indexing data:

> POST movies/marvels  
> {  
> "name": {  
> "input": [  
> "Captain America: The First Avenger",  
> "America: The First Avenger",  
> "The First Avenger",  
> "First Avenger",  
> "Avenger"  
> ]  
> },  
> "year": "2011"  
> }

Suggester:

> GET movies/marvels/\_search  
> {  
> "suggest": {  
> "movie-suggest-fuzzy": {  
> "prefix": "first avengar",  
> "completion": {  
> "field": "name",  
> "fuzzy": {  
> "fuzziness": 1  
> }  
> }  
> }  
> }  
> }

Result:

> "suggest": {  
> "movie-suggest-fuzzy": [  
> {  
> "text": "first avengar",  
> "offset": 0,  
> "length": 13,  
> "options": [  
> {  
> "text": "First Avenger",  
> "\_index": "movies",  
> "\_type": "marvels",  
> "\_id": "EbqgEmQBRGMJ9q2gdjM3",  
> "\_score": 11,  
> "\_source": {  
> "name": {  
> "input": [  
> "Captain America: The First Avenger",  
> "America: The First Avenger",  
> "The First Avenger",  
> "First Avenger",  
> "Avenger"  
> ]  
> }  
> }  
> }  
> ]  
> }  
> ]  
> }

The problem is I want to show "Captain America: The First Avenger" as suggestion but it only shows "First Avenger". What to do?

---

<div class="post-metadata">

**Author:** ![rs123](https://avatars.discourse-cdn.com/v4/letter/r/73ab20/32.png) [@rs123](https://discuss.elastic.co/u/rs123)\
**Post date:** [June 19, 2018, 5:20am UTC](https://discuss.elastic.co/t/elasticsearch-complete-suggestion-is-showing-only-half-sentence-why/136297/2 "2018-06-19T05:20:43Z")

</div>

Anyone?

---

<div class="post-metadata">

**Author:** ![rs123](https://avatars.discourse-cdn.com/v4/letter/r/73ab20/32.png) [@rs123](https://discuss.elastic.co/u/rs123)\
**Post date:** [June 20, 2018, 5:39am UTC](https://discuss.elastic.co/t/elasticsearch-complete-suggestion-is-showing-only-half-sentence-why/136297/3 "2018-06-20T05:39:12Z")

</div>

Someone?

---

<div class="post-metadata">

**Author:** ![rs123](https://avatars.discourse-cdn.com/v4/letter/r/73ab20/32.png) [@rs123](https://discuss.elastic.co/u/rs123)\
**Post date:** [June 21, 2018, 5:22am UTC](https://discuss.elastic.co/t/elasticsearch-complete-suggestion-is-showing-only-half-sentence-why/136297/4 "2018-06-21T05:22:43Z")

</div>

No one?

---

<div class="post-metadata">

**Author:** ![rs123](https://avatars.discourse-cdn.com/v4/letter/r/73ab20/32.png) [@rs123](https://discuss.elastic.co/u/rs123)\
**Post date:** [June 25, 2018, 5:44am UTC](https://discuss.elastic.co/t/elasticsearch-complete-suggestion-is-showing-only-half-sentence-why/136297/5 "2018-06-25T05:44:44Z")

</div>

Someone?

---

<div class="post-metadata">

**Author:** ![regularcoder](https://avatars.discourse-cdn.com/v4/letter/r/cdc98d/32.png) [@regularcoder](https://discuss.elastic.co/u/regularcoder)\
**Post date:** [July 12, 2018, 4:53am UTC](https://discuss.elastic.co/t/elasticsearch-complete-suggestion-is-showing-only-half-sentence-why/136297/6 "2018-07-12T04:53:54Z")

</div>

Completion suggester uses prefixes. The only way you're going to get "Captain America: The First Avenger" as a suggestion is to pass in something starting with C.

---

<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:** [August 9, 2018, 4:54am UTC](https://discuss.elastic.co/t/elasticsearch-complete-suggestion-is-showing-only-half-sentence-why/136297/7 "2018-08-09T04:54:00Z")

</div>

This topic was automatically closed 28 days after the last reply. New replies are no longer allowed.
