# Autocomplete with text in documents

**URL:** https://discuss.elastic.co/t/autocomplete-with-text-in-documents/140900
**Category:** Elasticsearch
**Created:** [July 20, 2018, 1:27pm UTC](https://discuss.elastic.co/t/autocomplete-with-text-in-documents/140900 "2018-07-20T13:27:26Z")
**Posts on this page:** 2
**Page:** 1

<div class="post-metadata">

### Author: ![edoardo.zanon](https://avatars.discourse-cdn.com/v4/letter/e/a9adbd/32.png) [@edoardo.zanon](https://discuss.elastic.co/u/edoardo.zanon)
#### Post date: [July 20, 2018, 1:27pm UTC](https://discuss.elastic.co/t/autocomplete-with-text-in-documents/140900/1 "2018-07-20T13:27:26Z")

</div>

Hi, I need to make an autocomplete in the text of documents.

Example:  
Text -\> "Hi, I'm ciccio an developer. bla bla"  
Text -\> "Hi, I'm ciccio an boy. bla bla"  
Text -\> "Hi, I'm ciccio bad boy. bla bla"

If someone search: "I'm ciccio" the user must see:  
-"I'm ciccio an"  
-"I'm ciccio bad"  
But if write: "I'm ciccio an" i must see:  
-"I'm ciccio an boy" and  
-"I'm ciccio an developer"

My idea is to execute a "phrase\_match" query with edge\_ngram filter, and use the highlights to make an distinct for equal text in on applicative level.

Suggest completition isn't maked for my usecase.

Exist an elasticsearch pattern for do this or the applicative level is the only way?

---

<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 17, 2018, 1:27pm UTC](https://discuss.elastic.co/t/autocomplete-with-text-in-documents/140900/2 "2018-08-17T13:27:27Z")

</div>

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