# Elasticsearch autocomplete- / suggest by token

**URL:** <https://discuss.elastic.co/t/elasticsearch-autocomplete-suggest-by-token/18392>\
**Category:** Elasticsearch\
**Created:** [June 30, 2014, 9:32am UTC](https://discuss.elastic.co/t/elasticsearch-autocomplete-suggest-by-token/18392 "2014-06-30T09:32:54Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![Christian\_Rutgers](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/christian_rutgers/32/500_2.png) [@Christian\_Rutgers](https://discuss.elastic.co/u/Christian_Rutgers)\
**Post date:** [June 30, 2014, 9:32am UTC](https://discuss.elastic.co/t/elasticsearch-autocomplete-suggest-by-token/18392/1 "2014-06-30T09:32:54Z")

</div>

After I had read \> 100 articles, blog-posts, documentation pages and much  
more I'll ask the community but still wonder where my blind spot is, if I  
had overseen the obvious.

I want to create search-suggestions on how to complete a term based on  
tokens, similar to g_oogle like autocomplete_ but only with one token or  
word.

I'd like to search across filenames who will get tokenized. E.g.  
"BRAND\_Connect\_A1233.jpg" gets tokenized into "brand", "connect", "a1234"  
and "jpg".

Now I'd like to ask for some suggestion for e.g. "_Con_". The suggestion  
should deliver the matching tokens, not the full filename:

- Connect
- Contour
- Concept
- ...

The suggestion for "_A12_" should be "A1234", "A1233", "A1233" ...

I created a complete test scenario, available at Gist:

> <https://gist.github.com/ChristianRuetgers/165a707a1e628caac73d>

Some remarks about the example:

- Working with queries, facet and filters works fine. The example is a  
minimized version of a much more complex scenario.
- Various approaches to get the desired suggestion does not deliver the  
expected results. I had tried to name the analyzers and tried various  
combinations of analyzers and wildcards.

Any help, pointer or working example will be highly appreciated.

Kind regards,  
Christian

--  
You received this message because you are subscribed to the Google Groups "elasticsearch" group.  
To unsubscribe from this group and stop receiving emails from it, send an email to [elasticsearch+unsubscribe@googlegroups.com](mailto:elasticsearch+unsubscribe@googlegroups.com).  
To view this discussion on the web visit [https://groups.google.com/d/msgid/elasticsearch/1daf5301-7048-43ea-9ee2-d208025e7922%40googlegroups.com](https://groups.google.com/d/msgid/elasticsearch/1daf5301-7048-43ea-9ee2-d208025e7922%40googlegroups.com).  
For more options, visit [https://groups.google.com/d/optout](https://groups.google.com/d/optout).

---

<div class="post-metadata">

**Author:** ![Izzat\_Sabbagh\_Rodrig](https://avatars.discourse-cdn.com/v4/letter/i/f04885/32.png) [@Izzat\_Sabbagh\_Rodrig](https://discuss.elastic.co/u/Izzat_Sabbagh_Rodrig)\
**Post date:** [March 16, 2015, 12:35pm UTC](https://discuss.elastic.co/t/elasticsearch-autocomplete-suggest-by-token/18392/2 "2015-03-16T12:35:25Z")

</div>

Hi Christian,

Have you found how to solve your question?..It's really hard to think that  
is not possible to do that with Elasticsearch. We have been also trying to  
achieve that, but no luck till today.

Thanks in advance,

Regards,

Izzat

El lunes, 30 de junio de 2014, 10:32:54 (UTC+1), Christian Rütgers escribió:

> After I had read \> 100 articles, blog-posts, documentation pages and much  
> more I'll ask the community but still wonder where my blind spot is, if I  
> had overseen the obvious.
> 
> I want to create search-suggestions on how to complete a term based on  
> tokens, similar to g_oogle like autocomplete_ but only with one token or  
> word.
> 
> I'd like to search across filenames who will get tokenized. E.g.  
> "BRAND\_Connect\_A1233.jpg" gets tokenized into "brand", "connect", "a1234"  
> and "jpg".
> 
> Now I'd like to ask for some suggestion for e.g. "_Con_". The suggestion  
> should deliver the matching tokens, not the full filename:
> 
> - Connect
> - Contour
> - Concept
> - ...
> 
> The suggestion for "_A12_" should be "A1234", "A1233", "A1233" ...
> 
> I created a complete test scenario, available at Gist:  
> [Elasticsearch autocomplete or autosuggest by token · GitHub](https://gist.github.com/165a707a1e628caac73d.git)
> 
> Some remarks about the example:
> 
> - Working with queries, facet and filters works fine. The example is a  
> minimized version of a much more complex scenario.
> - Various approaches to get the desired suggestion does not deliver  
> the expected results. I had tried to name the analyzers and tried various  
> combinations of analyzers and wildcards.
> 
> Any help, pointer or working example will be highly appreciated.
> 
> Kind regards,  
> Christian

--  
You received this message because you are subscribed to the Google Groups "elasticsearch" group.  
To unsubscribe from this group and stop receiving emails from it, send an email to [elasticsearch+unsubscribe@googlegroups.com](mailto:elasticsearch+unsubscribe@googlegroups.com).  
To view this discussion on the web visit [https://groups.google.com/d/msgid/elasticsearch/15cf562b-46f9-49db-b203-5e1076237b65%40googlegroups.com](https://groups.google.com/d/msgid/elasticsearch/15cf562b-46f9-49db-b203-5e1076237b65%40googlegroups.com).  
For more options, visit [https://groups.google.com/d/optout](https://groups.google.com/d/optout).

---

<div class="post-metadata">

**Author:** ![Christian\_Rutgers](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/christian_rutgers/32/500_2.png) [@Christian\_Rutgers](https://discuss.elastic.co/u/Christian_Rutgers)\
**Post date:** [March 16, 2015, 3:29pm UTC](https://discuss.elastic.co/t/elasticsearch-autocomplete-suggest-by-token/18392/3 "2015-03-16T15:29:58Z")

</div>

Dear Izzat,

finally yes, we had solved the problem.

The solution consist of the proper combination of mapping and query.  
I'll attach some examples, hope this will help you.

dam\_mapping.txt: The mapping.

dam\_query.txt: A typical query with two query strings and some facets

dam\_query\_result.txt: The result of the query.

Kind regards,

Christian Rütgers  
Head of interactive & IT

grintsch communications GmbH & Co. KG

Desk +49 (0)221 / 93 70 63-27  
Fax +49 (0)221 / 93 70 63-80  
[christian.ruetgers@grintsch.com](mailto:christian.ruetgers@grintsch.com) [mailto:christian.ruetgers@grintsch.com](mailto:christian.ruetgers@grintsch.com)

Am 16.03.2015 um 13:35 schrieb Izzat Sabbagh Rodríguez:

> Hi Christian,
> 
> Have you found how to solve your question?..It's really hard to think  
> that is not possible to do that with Elasticsearch. We have been also  
> trying to achieve that, but no luck till today.
> 
> Thanks in advance,
> 
> Regards,
> 
> Izzat
> 
> El lunes, 30 de junio de 2014, 10:32:54 (UTC+1), Christian Rütgers  
> escribió:
> 
> ```
> After I had read > 100 articles, blog-posts, documentation pages
> and much more I'll ask the community but still wonder where my
> blind spot is, if I had overseen the obvious.
> 
> I want to create search-suggestions on how to complete a term
> based on tokens, similar to g*oogle like autocomplete* but only
> with one token or word.
> 
> I'd like to search across filenames who will get tokenized. E.g.
> "BRAND_Connect_A1233.jpg" gets tokenized into "brand", "connect",
> "a1234" and "jpg".
> 
> Now I'd like to ask for some suggestion for e.g. "*Con*". The
> suggestion should deliver the matching tokens, not the full filename:
> 
> * Connect
> * Contour
> * Concept
> * ...
> 
> The suggestion for "*A12*" should be "A1234", "A1233", "A1233" ...
> 
> I created a complete test scenario, available at Gist:
> https://gist.github.com/165a707a1e628caac73d.git
> <https://gist.github.com/165a707a1e628caac73d.git>
> 
> Some remarks about the example:
> 
> * Working with queries, facet and filters works fine. The
> example is a minimized version of a much more complex scenario.
> * Various approaches to get the desired suggestion does not
> deliver the expected results. I had tried to name the
> analyzers and tried various combinations of analyzers and
> wildcards.
> 
> Any help, pointer or working example will be highly appreciated.
> 
> Kind regards,
> Christian
> 
> ```
> 
> --  
> You received this message because you are subscribed to a topic in the  
> Google Groups "elasticsearch" group.  
> To unsubscribe from this topic, visit  
> [https://groups.google.com/d/topic/elasticsearch/yiebM3dm4EE/unsubscribe](https://groups.google.com/d/topic/elasticsearch/yiebM3dm4EE/unsubscribe).  
> To unsubscribe from this group and all its topics, send an email to  
> [elasticsearch+unsubscribe@googlegroups.com](mailto:elasticsearch+unsubscribe@googlegroups.com)  
> [mailto:elasticsearch+unsubscribe@googlegroups.com](mailto:elasticsearch+unsubscribe@googlegroups.com).  
> To view this discussion on the web visit  
> [https://groups.google.com/d/msgid/elasticsearch/15cf562b-46f9-49db-b203-5e1076237b65%40googlegroups.com](https://groups.google.com/d/msgid/elasticsearch/15cf562b-46f9-49db-b203-5e1076237b65%40googlegroups.com)  
> [https://groups.google.com/d/msgid/elasticsearch/15cf562b-46f9-49db-b203-5e1076237b65%40googlegroups.com?utm\_medium=email&utm\_source=footer](https://groups.google.com/d/msgid/elasticsearch/15cf562b-46f9-49db-b203-5e1076237b65%40googlegroups.com?utm_medium=email&utm_source=footer).  
> For more options, visit [https://groups.google.com/d/optout](https://groups.google.com/d/optout).

--  
You received this message because you are subscribed to the Google Groups "elasticsearch" group.  
To unsubscribe from this group and stop receiving emails from it, send an email to [elasticsearch+unsubscribe@googlegroups.com](mailto:elasticsearch+unsubscribe@googlegroups.com).  
To view this discussion on the web visit [https://groups.google.com/d/msgid/elasticsearch/5506F6F6.9030904%40grintsch.com](https://groups.google.com/d/msgid/elasticsearch/5506F6F6.9030904%40grintsch.com).  
For more options, visit [https://groups.google.com/d/optout](https://groups.google.com/d/optout).

---

<div class="post-metadata">

**Author:** ![Izzat\_Sabbagh\_Rodrig](https://avatars.discourse-cdn.com/v4/letter/i/f04885/32.png) [@Izzat\_Sabbagh\_Rodrig](https://discuss.elastic.co/u/Izzat_Sabbagh_Rodrig)\
**Post date:** [March 16, 2015, 4:39pm UTC](https://discuss.elastic.co/t/elasticsearch-autocomplete-suggest-by-token/18392/4 "2015-03-16T16:39:46Z")

</div>

Thank you very much Christian¡¡¡

El lunes, 16 de marzo de 2015, 15:30:24 (UTC), Christian Rütgers escribió:

> Dear Izzat,
> 
> finally yes, we had solved the problem.
> 
> The solution consist of the proper combination of mapping and query. I'll  
> attach some examples, hope this will help you.
> 
> dam\_mapping.txt: The mapping.
> 
> dam\_query.txt: A typical query with two query strings and some facets
> 
> dam\_query\_result.txt: The result of the query.
> 
> Kind regards,
> 
> Christian Rütgers  
> Head of interactive & IT
> 
> grintsch communications GmbH & Co. KG
> 
> Desk +49 (0)221 / 93 70 63-27  
> Fax +49 (0)221 / 93 70 63-80  
> [christian...@grintsch.com](mailto:christian...@grintsch.com) \<javascript:\>
> 
> Am 16.03.2015 um 13:35 schrieb Izzat Sabbagh Rodríguez:
> 
> Hi Christian,
> 
> Have you found how to solve your question?..It's really hard to think  
> that is not possible to do that with Elasticsearch. We have been also  
> trying to achieve that, but no luck till today.
> 
> Thanks in advance,
> 
> Regards,
> 
> Izzat
> 
> El lunes, 30 de junio de 2014, 10:32:54 (UTC+1), Christian Rütgers  
> escribió:
> 
> > After I had read \> 100 articles, blog-posts, documentation pages and  
> > much more I'll ask the community but still wonder where my blind spot is,  
> > if I had overseen the obvious.
> > 
> > I want to create search-suggestions on how to complete a term based on  
> > tokens, similar to g_oogle like autocomplete_ but only with one token or  
> > word.
> > 
> > I'd like to search across filenames who will get tokenized. E.g.  
> > "BRAND\_Connect\_A1233.jpg" gets tokenized into "brand", "connect", "a1234"  
> > and "jpg".
> > 
> > Now I'd like to ask for some suggestion for e.g. "_Con_". The suggestion  
> > should deliver the matching tokens, not the full filename:
> > 
> > - Connect
> > - Contour
> > - Concept
> > - ...
> > 
> > The suggestion for "_A12_" should be "A1234", "A1233", "A1233" ...
> > 
> > I created a complete test scenario, available at Gist:  
> > [Elasticsearch autocomplete or autosuggest by token · GitHub](https://gist.github.com/165a707a1e628caac73d.git)
> > 
> > Some remarks about the example:
> > 
> > - Working with queries, facet and filters works fine. The example is  
> > a minimized version of a much more complex scenario.  
> > - Various approaches to get the desired suggestion does not deliver  
> > the expected results. I had tried to name the analyzers and tried various  
> > combinations of analyzers and wildcards.
> > 
> > Any help, pointer or working example will be highly appreciated.
> > 
> > Kind regards,  
> > Christian
> > 
> > --  
> > You received this message because you are subscribed to a topic in the  
> > Google Groups "elasticsearch" group.  
> > To unsubscribe from this topic, visit  
> > [https://groups.google.com/d/topic/elasticsearch/yiebM3dm4EE/unsubscribe](https://groups.google.com/d/topic/elasticsearch/yiebM3dm4EE/unsubscribe).  
> > To unsubscribe from this group and all its topics, send an email to  
> > [elasticsearc...@googlegroups.com](mailto:elasticsearc...@googlegroups.com) \<javascript:\>.  
> > To view this discussion on the web visit  
> > [https://groups.google.com/d/msgid/elasticsearch/15cf562b-46f9-49db-b203-5e1076237b65%40googlegroups.com](https://groups.google.com/d/msgid/elasticsearch/15cf562b-46f9-49db-b203-5e1076237b65%40googlegroups.com)  
> > [https://groups.google.com/d/msgid/elasticsearch/15cf562b-46f9-49db-b203-5e1076237b65%40googlegroups.com?utm\_medium=email&utm\_source=footer](https://groups.google.com/d/msgid/elasticsearch/15cf562b-46f9-49db-b203-5e1076237b65%40googlegroups.com?utm_medium=email&utm_source=footer)  
> > .  
> > For more options, visit [https://groups.google.com/d/optout](https://groups.google.com/d/optout).

--  
You received this message because you are subscribed to the Google Groups "elasticsearch" group.  
To unsubscribe from this group and stop receiving emails from it, send an email to [elasticsearch+unsubscribe@googlegroups.com](mailto:elasticsearch+unsubscribe@googlegroups.com).  
To view this discussion on the web visit [https://groups.google.com/d/msgid/elasticsearch/cb535ab5-b57a-424e-81f7-ef12c729d036%40googlegroups.com](https://groups.google.com/d/msgid/elasticsearch/cb535ab5-b57a-424e-81f7-ef12c729d036%40googlegroups.com).  
For more options, visit [https://groups.google.com/d/optout](https://groups.google.com/d/optout).

---

<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, 12:26am UTC](https://discuss.elastic.co/t/elasticsearch-autocomplete-suggest-by-token/18392/5 "2017-07-06T00:26:29Z")

</div>


