# Is there a better way to achieve my goal than having multiple completion suggesters on a single index?

**URL:** <https://discuss.elastic.co/t/is-there-a-better-way-to-achieve-my-goal-than-having-multiple-completion-suggesters-on-a-single-index/18822>\
**Category:** Elasticsearch\
**Created:** [July 23, 2014, 1:20pm UTC](https://discuss.elastic.co/t/is-there-a-better-way-to-achieve-my-goal-than-having-multiple-completion-suggesters-on-a-single-index/18822 "2014-07-23T13:20:44Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![Gordon\_Rankin](https://avatars.discourse-cdn.com/v4/letter/g/6a8cbe/32.png) [@Gordon\_Rankin](https://discuss.elastic.co/u/Gordon_Rankin)\
**Post date:** [July 23, 2014, 1:20pm UTC](https://discuss.elastic.co/t/is-there-a-better-way-to-achieve-my-goal-than-having-multiple-completion-suggesters-on-a-single-index/18822/1 "2014-07-23T13:20:44Z")

</div>

I have an index of photos and need to return completion suggestions based  
on several of the fields:

- Tags
- Place
- Country
- Date

The simplest way to do this of course would be to create one completion  
suggester and simply feed the various inputs into it when indexing.

However, I need to receive up to 5 suggestions per field and I need to  
return various different outputs depending on the input (they cannot simply  
have a unified output)

For example:

When the user types "T" the suggestions should be something like the  
following :

Tags : [Tree, Tiger, Toner]  
Place : [Tenerife, The London Eye, Torquay]  
Country : [Taiwan, Tanzania]  
Date : []

The date field simply stores tags for the month and year [January, 2014]  
enabling suggestions to come back as January when a user types "jan" and  
gives year suggestions when the user type "20" etc...

In order to achieve this I have set up a different completion suggester  
with varying analyzers for each of the above fields, I then query all four  
suggesters at once in a single request. Everything works perfectly.

However I am left wondering if there is a better way to achieve this  
functionality.

- Is there any way to achieve the above with a single completion  
suggester
- Are there any concerns/watch outs when querying multiple suggesters in  
this manner? Performance or otherwise.

Thanks in advance for any advice or suggestions.

--  
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/bd670fb7-303f-4719-821c-82b65fec86e9%40googlegroups.com](https://groups.google.com/d/msgid/elasticsearch/bd670fb7-303f-4719-821c-82b65fec86e9%40googlegroups.com).  
For more options, visit [https://groups.google.com/d/optout](https://groups.google.com/d/optout).

---

<div class="post-metadata">

**Author:** ![jpountz](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/jpountz/32/45836_2.png) [@jpountz](https://discuss.elastic.co/u/jpountz)\
**Post date:** [July 23, 2014, 1:33pm UTC](https://discuss.elastic.co/t/is-there-a-better-way-to-achieve-my-goal-than-having-multiple-completion-suggesters-on-a-single-index/18822/2 "2014-07-23T13:33:57Z")

</div>

Hi Gordon,

Given your requirements, I think you are doing the right thing. There is no  
particular concern wrt querying multiple suggesters at the same time.

On Wed, Jul 23, 2014 at 3:20 PM, Gordon Rankin [gordon@ripplesoup.com](mailto:gordon@ripplesoup.com)  
wrote:

> I have an index of photos and need to return completion suggestions based  
> on several of the fields:
> 
> - Tags
> - Place
> - Country
> - Date
> 
> The simplest way to do this of course would be to create one completion  
> suggester and simply feed the various inputs into it when indexing.
> 
> However, I need to receive up to 5 suggestions per field and I need to  
> return various different outputs depending on the input (they cannot simply  
> have a unified output)
> 
> For example:
> 
> When the user types "T" the suggestions should be something like the  
> following :
> 
> Tags : [Tree, Tiger, Toner]  
> Place : [Tenerife, The London Eye, Torquay]  
> Country : [Taiwan, Tanzania]  
> Date :
> 
> The date field simply stores tags for the month and year [January, 2014]  
> enabling suggestions to come back as January when a user types "jan" and  
> gives year suggestions when the user type "20" etc...
> 
> In order to achieve this I have set up a different completion suggester  
> with varying analyzers for each of the above fields, I then query all four  
> suggesters at once in a single request. Everything works perfectly.
> 
> However I am left wondering if there is a better way to achieve this  
> functionality.
> 
> - Is there any way to achieve the above with a single completion  
> suggester
> - Are there any concerns/watch outs when querying multiple suggesters  
> in this manner? Performance or otherwise.
> 
> Thanks in advance for any advice or suggestions.
> 
> --  
> 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/bd670fb7-303f-4719-821c-82b65fec86e9%40googlegroups.com](https://groups.google.com/d/msgid/elasticsearch/bd670fb7-303f-4719-821c-82b65fec86e9%40googlegroups.com)  
> [https://groups.google.com/d/msgid/elasticsearch/bd670fb7-303f-4719-821c-82b65fec86e9%40googlegroups.com?utm\_medium=email&utm\_source=footer](https://groups.google.com/d/msgid/elasticsearch/bd670fb7-303f-4719-821c-82b65fec86e9%40googlegroups.com?utm_medium=email&utm_source=footer)  
> .  
> For more options, visit [https://groups.google.com/d/optout](https://groups.google.com/d/optout).

--  
Adrien Grand

--  
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/CAL6Z4j4%2BPdWf1xrX9DoWA7FgWfKjE\_ytTG-UpBTG%3DkEYWJ90ng%40mail.gmail.com](https://groups.google.com/d/msgid/elasticsearch/CAL6Z4j4%2BPdWf1xrX9DoWA7FgWfKjE_ytTG-UpBTG%3DkEYWJ90ng%40mail.gmail.com).  
For more options, visit [https://groups.google.com/d/optout](https://groups.google.com/d/optout).

---

<div class="post-metadata">

**Author:** ![Gordon\_Rankin](https://avatars.discourse-cdn.com/v4/letter/g/6a8cbe/32.png) [@Gordon\_Rankin](https://discuss.elastic.co/u/Gordon_Rankin)\
**Post date:** [July 23, 2014, 1:38pm UTC](https://discuss.elastic.co/t/is-there-a-better-way-to-achieve-my-goal-than-having-multiple-completion-suggesters-on-a-single-index/18822/3 "2014-07-23T13:38:00Z")

</div>

Thanks Adrien...

Thanks for your speedy response. I'm very new to Elasticsearch so it's  
good to know I am doing the write thing.

I guess i'll continue as I am unless anyone else can think of any reason  
not to.

Cheers!

On Wednesday, July 23, 2014 2:34:08 PM UTC+1, Adrien Grand wrote:

> Hi Gordon,
> 
> Given your requirements, I think you are doing the right thing. There is  
> no particular concern wrt querying multiple suggesters at the same time.
> 
> On Wed, Jul 23, 2014 at 3:20 PM, Gordon Rankin \<[gor...@ripplesoup.com](mailto:gor...@ripplesoup.com)  
> \<javascript:\>\> wrote:
> 
> > I have an index of photos and need to return completion suggestions based  
> > on several of the fields:
> > 
> > - Tags
> > - Place
> > - Country
> > - Date
> > 
> > The simplest way to do this of course would be to create one completion  
> > suggester and simply feed the various inputs into it when indexing.
> > 
> > However, I need to receive up to 5 suggestions per field and I need to  
> > return various different outputs depending on the input (they cannot simply  
> > have a unified output)
> > 
> > For example:
> > 
> > When the user types "T" the suggestions should be something like the  
> > following :
> > 
> > Tags : [Tree, Tiger, Toner]  
> > Place : [Tenerife, The London Eye, Torquay]  
> > Country : [Taiwan, Tanzania]  
> > Date :
> > 
> > The date field simply stores tags for the month and year [January, 2014]  
> > enabling suggestions to come back as January when a user types "jan" and  
> > gives year suggestions when the user type "20" etc...
> > 
> > In order to achieve this I have set up a different completion suggester  
> > with varying analyzers for each of the above fields, I then query all four  
> > suggesters at once in a single request. Everything works perfectly.
> > 
> > However I am left wondering if there is a better way to achieve this  
> > functionality.
> > 
> > - Is there any way to achieve the above with a single completion  
> > suggester
> > - Are there any concerns/watch outs when querying multiple suggesters  
> > in this manner? Performance or otherwise.
> > 
> > Thanks in advance for any advice or suggestions.
> > 
> > --  
> > 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 [elasticsearc...@googlegroups.com](mailto:elasticsearc...@googlegroups.com) \<javascript:\>.  
> > To view this discussion on the web visit  
> > [https://groups.google.com/d/msgid/elasticsearch/bd670fb7-303f-4719-821c-82b65fec86e9%40googlegroups.com](https://groups.google.com/d/msgid/elasticsearch/bd670fb7-303f-4719-821c-82b65fec86e9%40googlegroups.com)  
> > [https://groups.google.com/d/msgid/elasticsearch/bd670fb7-303f-4719-821c-82b65fec86e9%40googlegroups.com?utm\_medium=email&utm\_source=footer](https://groups.google.com/d/msgid/elasticsearch/bd670fb7-303f-4719-821c-82b65fec86e9%40googlegroups.com?utm_medium=email&utm_source=footer)  
> > .  
> > For more options, visit [https://groups.google.com/d/optout](https://groups.google.com/d/optout).
> 
> --  
> Adrien Grand

--  
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/b10e1f2a-7b3c-4102-a855-aae78da02bea%40googlegroups.com](https://groups.google.com/d/msgid/elasticsearch/b10e1f2a-7b3c-4102-a855-aae78da02bea%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, 1:13am UTC](https://discuss.elastic.co/t/is-there-a-better-way-to-achieve-my-goal-than-having-multiple-completion-suggesters-on-a-single-index/18822/4 "2017-07-06T01:13:57Z")

</div>


