Autocomplete with text in documents

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?

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