# How to enable elasticsearch auto-complete return only matching word

**URL:** <https://discuss.elastic.co/t/how-to-enable-elasticsearch-auto-complete-return-only-matching-word/63124>\
**Category:** Elasticsearch\
**Created:** [October 16, 2016, 9:13am UTC](https://discuss.elastic.co/t/how-to-enable-elasticsearch-auto-complete-return-only-matching-word/63124 "2016-10-16T09:13:18Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![psilos](https://avatars.discourse-cdn.com/v4/letter/p/c0e974/32.png) [@psilos](https://discuss.elastic.co/u/psilos)\
**Post date:** [October 16, 2016, 9:13am UTC](https://discuss.elastic.co/t/how-to-enable-elasticsearch-auto-complete-return-only-matching-word/63124/1 "2016-10-16T09:13:18Z")

</div>

I need to implement auto-complete but I m not sure about the exact strategy. For example I have the following product :

Highsound Smart Phone Watch for Android (Gray)  
So I need when the user starts typing: "s", "sm", "smar" , the word "smart" or "smart watch" to come out rather than the whole phrase: Highsound Smart Phone Watch for Android (Gray)

I looked around how google, amazon etc. do it and they dont display the whole matching record, but rather they display either only the word ("smart") or a phrase ("smart watch").

Right now I enable the automcomplete in elasticsearch according to the following link, but it returns the whole name of the matching record.

[https://www.elastic.co/guide/en/elasticsearch/guide/current/\_index\_time\_search\_as\_you\_type.html](https://www.elastic.co/guide/en/elasticsearch/guide/current/_index_time_search_as_you_type.html)

Any suggestions?

---

<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:11pm UTC](https://discuss.elastic.co/t/how-to-enable-elasticsearch-auto-complete-return-only-matching-word/63124/2 "2017-07-05T22:11:56Z")

</div>


