# Autocompleter

**URL:** <https://discuss.elastic.co/t/autocompleter/6057>\
**Category:** Elasticsearch\
**Created:** [December 2, 2011, 5:54pm UTC](https://discuss.elastic.co/t/autocompleter/6057 "2011-12-02T17:54:26Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![Valdas](https://avatars.discourse-cdn.com/v4/letter/v/c2a13f/32.png) [@Valdas](https://discuss.elastic.co/u/Valdas)\
**Post date:** [December 2, 2011, 5:54pm UTC](https://discuss.elastic.co/t/autocompleter/6057/1 "2011-12-02T17:54:26Z")

</div>

hello,  
it's possible to create autocompleter. In solr is very easy to create  
them. But in ES is not simple. We trying it write with regexp. But  
it's not fast. Best way to create autocompleter is? We trying to make  
ex.how google. then user typing word example g (must show google,  
gmail and etc), if add go (it's showing google)

Thanks for help.

---

<div class="post-metadata">

**Author:** ![Karussell1](https://avatars.discourse-cdn.com/v4/letter/k/50afbb/32.png) [@Karussell1](https://discuss.elastic.co/u/Karussell1)\
**Post date:** [December 2, 2011, 9:14pm UTC](https://discuss.elastic.co/t/autocompleter/6057/2 "2011-12-02T21:14:05Z")

</div>

> But in ES is not simple

probably less documentation exists, but calling something not simple  
depends on a lot stuff 😉

Using the (edge) n gram token filter should give you the direction to  
one possible solution.

Regards,  
Peter.

On 2 Dez., 18:54, Valdas [valdas.jancaus...@gmail.com](mailto:valdas.jancaus...@gmail.com) wrote:

> hello,  
> it's possible to create autocompleter. In solr is very easy to create  
> them. But in ES is not simple. We trying it write with regexp. But  
> it's not fast. Best way to create autocompleter is? We trying to make  
> ex.how google. then user typing word example g (must show google,  
> gmail and etc), if add go (it's showing google)
> 
> Thanks for help.

---

<div class="post-metadata">

**Author:** ![kimchy](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/kimchy/32/44952_2.png) [@kimchy](https://discuss.elastic.co/u/kimchy)\
**Post date:** [December 4, 2011, 2:46pm UTC](https://discuss.elastic.co/t/autocompleter/6057/3 "2011-12-04T14:46:31Z")

</div>

Are you referring to the "suggester" functionality in Lucene? If so, I am  
not a big fan of it, because it is not "realtime" and requires rebuilding  
it periodically (which can get really expensive), so, at least now, its not  
implemented in elasticsearch.

Obviously, many people have implemented auto suggest by simply doing  
"search", using things like ngrams.

On Fri, Dec 2, 2011 at 7:54 PM, Valdas [valdas.jancauskas@gmail.com](mailto:valdas.jancauskas@gmail.com) wrote:

> hello,  
> it's possible to create autocompleter. In solr is very easy to create  
> them. But in ES is not simple. We trying it write with regexp. But  
> it's not fast. Best way to create autocompleter is? We trying to make  
> ex.how google. then user typing word example g (must show google,  
> gmail and etc), if add go (it's showing google)
> 
> Thanks for help.

---

<div class="post-metadata">

**Author:** ![Valdas](https://avatars.discourse-cdn.com/v4/letter/v/c2a13f/32.png) [@Valdas](https://discuss.elastic.co/u/Valdas)\
**Post date:** [December 6, 2011, 8:44am UTC](https://discuss.elastic.co/t/autocompleter/6057/4 "2011-12-06T08:44:49Z")

</div>

Our autocompleter structure:  
ID, 'categories', 'keywordsAnalyze', 'keywordsNoAnalyze';

ex. if user typing one word (ex.w "demon"), it using regexp:  
{"query":{"match\_all":{}},"from":0,"size":10,"facets":  
{"group\_by\_terms":{"terms":{"field":"keywordsNoAnalyze","size":  
10,"regex":"demon._","regex\_flags":"DOTALL"}}}}  
if user typing word with to words (it using regexp and query):  
{"query":{"query\_string":{"query":"keywordsAnalyze: (+demon)"}},"from":  
0,"size":5,"facets":{"group\_by\_terms":{"terms":  
{"field":"keywordsNoAnalyze","size":  
10,"regex":"ga._","regex\_flags":"DOTALL"}}}}.

Now i will try it with ngrams. 😉

---

<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 6, 2017, 3:46am UTC](https://discuss.elastic.co/t/autocompleter/6057/5 "2017-07-06T03:46:19Z")

</div>


