Simple way to implement autocomplete functionality?

As I explained here:
I would like to implement a simple autocomplete; user starts typing, the index is consulted and similar keywords are returned. E.g. auth -> authorization, authentication.

I found the Completion Suggester way:

However, that seems too complicated, I'm thinking there must be some other way.

And also, I don't seem to understand the completion suggester properly. I have to do that mapping and then I have to provide suggestions?! How does that work? I see the "Index" section of the article where apparently I have to provide options... for what words - how could any setting of mine ever cover all that a user could type? I don't get it.

On the other hand, word correction which is clearly a more difficult thing to implement, can be done out of the box with a simple Suggester query. It seems ridiculous that autocomplete cannot come out of the box as well...

Any help would be appreciated.

Many thanks,

please read this book elasticsearch guide
it has all kinds of information regarding dealing with ES in detail.

1 Like

Do you happen to know how to use the Completion Suggester in a real scenario?

I read the documentation but it makes no sense to me.
Maybe it works for clearly sturctured data, like music albums. You index the albums and then you go one-by-one and index suggestion possibilities ... !?

How does that work for full texts, entire documents? How do I automate the process of indexing suggestions? It surely cannot be that I have to go and manually index suggestions that I think the user might type...


you need to write scripts to automate the indexing.
you need to index all the data which you have to be able to searchable for the user.
please take some ES course for more clarification.

So after I index a document, is it my job to parse the contents of a field, split it in words/tokens and implement logic to specify autocompletion options for each word and index them? Again, I don't think it can be this way: ES has the power to auto-correct words, but it doesn't have the power to auto-complete them?!

I would expect ES to be able to do that once I indexed the document (probably I would have to specify some analyzier or whatever)...

NO, ES will do it

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