# Completion suggester with separated doc types (multiple indices?)

**URL:** <https://discuss.elastic.co/t/completion-suggester-with-separated-doc-types-multiple-indices/15014>\
**Category:** Elasticsearch\
**Created:** [December 24, 2013, 3:50pm UTC](https://discuss.elastic.co/t/completion-suggester-with-separated-doc-types-multiple-indices/15014 "2013-12-24T15:50:58Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![Facundo\_Olano](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/facundo_olano/32/1623_2.png) [@Facundo\_Olano](https://discuss.elastic.co/u/Facundo_Olano)\
**Post date:** [December 24, 2013, 3:50pm UTC](https://discuss.elastic.co/t/completion-suggester-with-separated-doc-types-multiple-indices/15014/1 "2013-12-24T15:50:58Z")

</div>

Hello, I've started playing around with the completion suggester to  
implement autocomplete functionality in my application and found it pretty  
straightforward and simple to use.

The problem I have is that I don't want mixed types in my suggestions: if  
have a "music" index with "song" and "artist" types, I want to have "song"  
and "artist" autocompletes. From the documentation I get that this doesn't  
seem to be supported, so I'm considering having a separate index for each  
type. I've read[http://elasticsearch-users.115913.n3.nabble.com/More-indices-vs-more-types-td3999423.html#a4002051](http://elasticsearch-users.115913.n3.nabble.com/More-indices-vs-more-types-td3999423.html#a4002051)that this is not the best practice, but from the size of my data I presume  
I won't be having problems: I have around 10 types, most of them with  
around 2000 documents. It's worth noting that I'm just using elasticsearch  
for this autocomplete functionality (although I may use it for regular  
search eventually).

So I wanted to check if it makes sense modeling my indices that way or if  
there's an alternative solution to my problem (for example, using the suggest  
plugin [https://github.com/spinscale/elasticsearch-suggest-plugin](https://github.com/spinscale/elasticsearch-suggest-plugin)?)

Thanks,  
Facundo.

--  
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/65d950a0-0784-46eb-94c3-7689ab858fe2%40googlegroups.com](https://groups.google.com/d/msgid/elasticsearch/65d950a0-0784-46eb-94c3-7689ab858fe2%40googlegroups.com).  
For more options, visit [https://groups.google.com/groups/opt\_out](https://groups.google.com/groups/opt_out).

---

<div class="post-metadata">

**Author:** ![spinscale](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/spinscale/32/25011_2.png) [@spinscale](https://discuss.elastic.co/u/spinscale)\
**Post date:** [December 25, 2013, 12:28am UTC](https://discuss.elastic.co/t/completion-suggester-with-separated-doc-types-multiple-indices/15014/2 "2013-12-25T00:28:50Z")

</div>

Hey,

the way the completion suggester is implemented, it does not support  
filtering by types (neither does the suggest plugin) - so this makes a  
pretty clear decision process for your use-case. The reason for this, is  
the different approach how suggest data is stored and queried - in a  
nutshell, the suggest data structure simply takes the whole index data and  
uses it for suggestions. The type itself is simply spoken just another  
metadata, which cannot be filtered out.

I'd go with the completion suggester if possible (as I wrote the suggest  
plugin I can tell that the completion suggester has a way better design,  
and, obviously, is part of the core).

Hope this helps...

--Alex

On Tue, Dec 24, 2013 at 4:50 PM, Facundo Olano [facundo.olano@gmail.com](mailto:facundo.olano@gmail.com)wrote:

> Hello, I've started playing around with the completion suggester to  
> implement autocomplete functionality in my application and found it pretty  
> straightforward and simple to use.
> 
> The problem I have is that I don't want mixed types in my suggestions: if  
> have a "music" index with "song" and "artist" types, I want to have "song"  
> and "artist" autocompletes. From the documentation I get that this doesn't  
> seem to be supported, so I'm considering having a separate index for each  
> type. I've read[http://elasticsearch-users.115913.n3.nabble.com/More-indices-vs-more-types-td3999423.html#a4002051](http://elasticsearch-users.115913.n3.nabble.com/More-indices-vs-more-types-td3999423.html#a4002051)that this is not the best practice, but from the size of my data I presume  
> I won't be having problems: I have around 10 types, most of them with  
> around 2000 documents. It's worth noting that I'm just using elasticsearch  
> for this autocomplete functionality (although I may use it for regular  
> search eventually).
> 
> So I wanted to check if it makes sense modeling my indices that way or if  
> there's an alternative solution to my problem (for example, using the suggest  
> plugin [https://github.com/spinscale/elasticsearch-suggest-plugin](https://github.com/spinscale/elasticsearch-suggest-plugin)?)
> 
> Thanks,  
> Facundo.
> 
> --  
> 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/65d950a0-0784-46eb-94c3-7689ab858fe2%40googlegroups.com](https://groups.google.com/d/msgid/elasticsearch/65d950a0-0784-46eb-94c3-7689ab858fe2%40googlegroups.com)  
> .  
> For more options, visit [https://groups.google.com/groups/opt\_out](https://groups.google.com/groups/opt_out).

--  
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/CAGCwEM9E1D57m%2B1d8HM2jfyawo3COuadybgds2LhzoQv3Lw86w%40mail.gmail.com](https://groups.google.com/d/msgid/elasticsearch/CAGCwEM9E1D57m%2B1d8HM2jfyawo3COuadybgds2LhzoQv3Lw86w%40mail.gmail.com).  
For more options, visit [https://groups.google.com/groups/opt\_out](https://groups.google.com/groups/opt_out).

---

<div class="post-metadata">

**Author:** ![Facundo\_Olano](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/facundo_olano/32/1623_2.png) [@Facundo\_Olano](https://discuss.elastic.co/u/Facundo_Olano)\
**Post date:** [December 26, 2013, 3:20pm UTC](https://discuss.elastic.co/t/completion-suggester-with-separated-doc-types-multiple-indices/15014/3 "2013-12-26T15:20:50Z")

</div>

I see, I'll go with an index per type then, thanks for the answer.

--  
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/ac6dfe21-de37-4b31-8a3a-8d3c76bff9cc%40googlegroups.com](https://groups.google.com/d/msgid/elasticsearch/ac6dfe21-de37-4b31-8a3a-8d3c76bff9cc%40googlegroups.com).  
For more options, visit [https://groups.google.com/groups/opt\_out](https://groups.google.com/groups/opt_out).

---

<div class="post-metadata">

**Author:** ![timbunce](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/timbunce/32/44945_2.png) [@timbunce](https://discuss.elastic.co/u/timbunce)\
**Post date:** [December 27, 2013, 7:47pm UTC](https://discuss.elastic.co/t/completion-suggester-with-separated-doc-types-multiple-indices/15014/4 "2013-12-27T19:47:53Z")

</div>

Suggestion requests, including the completion suggester, operate on  
specific field names.

So extra type-specific field names can be used to store the suggestion data.

Then, to get suggestions for a particular type you'd query the corresponding  
type-specific field name.

Tim.

On Wed, Dec 25, 2013 at 01:28:50AM +0100, Alexander Reelsen wrote:

> Hey,  
> the way the completion suggester is implemented, it does not support filtering by types (neither does  
> the suggest plugin) - so this makes a pretty clear decision process for your use-case. The reason for  
> this, is the different approach how suggest data is stored and queried - in a nutshell, the suggest data  
> structure simply takes the whole index data and uses it for suggestions. The type itself is simply  
> spoken just another metadata, which cannot be filtered out.  
> I'd go with the completion suggester if possible (as I wrote the suggest plugin I can tell that the  
> completion suggester has a way better design, and, obviously, is part of the core).  
> Hope this helps...  
> --Alex
> 
> On Tue, Dec 24, 2013 at 4:50 PM, Facundo Olano \<[1]facundo.olano@gmail.com\> wrote:
> 
> ```
> Hello, I've started playing around with the completion suggester to implement autocomplete
> functionality in my application and found it pretty straightforward and simple to use.
> The problem I have is that I don't want mixed types in my suggestions: if have a "music" index with
> "song" and "artist" types, I want to have "song" and "artist" autocompletes. From the documentation I
> get that this doesn't seem to be supported, so I'm considering having a separate index for each type.
> [2]I've read that this is not the best practice, but from the size of my data I presume I won't be
> having problems: I have around 10 types, most of them with around 2000 documents. It's worth noting
> that I'm just using elasticsearch for this autocomplete functionality (although I may use it for
> regular search eventually).
> So I wanted to check if it makes sense modeling my indices that way or if there's an alternative
> solution to my problem (for example, using the [3]suggest plugin?)
> Thanks,
> Facundo.
> 
> --
> 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
> [4]elasticsearch+unsubscribe@googlegroups.com.
> To view this discussion on the web visit
> [5]https://groups.google.com/d/msgid/elasticsearch/65d950a0-0784-46eb-94c3-7689ab858fe2%40googlegroups.com.
> For more options, visit [6]https://groups.google.com/groups/opt_out.
> 
> ```
> 
> --  
> 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  
> [7][https://groups.google.com/d/msgid/elasticsearch/CAGCwEM9E1D57m%2B1d8HM2jfyawo3COuadybgds2LhzoQv3Lw86w%40mail.gmail.com](https://groups.google.com/d/msgid/elasticsearch/CAGCwEM9E1D57m%2B1d8HM2jfyawo3COuadybgds2LhzoQv3Lw86w%40mail.gmail.com).  
> For more options, visit [8][https://groups.google.com/groups/opt\_out](https://groups.google.com/groups/opt_out).
> 
> References
> 
> Visible links
> 
> 1. [mailto:facundo.olano@gmail.com](mailto:facundo.olano@gmail.com)
> 2. [http://elasticsearch-users.115913.n3.nabble.com/More-indices-vs-more-types-td3999423.html#a4002051](http://elasticsearch-users.115913.n3.nabble.com/More-indices-vs-more-types-td3999423.html#a4002051)
> 3. [GitHub - spinscale/elasticsearch-suggest-plugin: Plugin for elasticsearch which uses the lucene FSTSuggester](https://github.com/spinscale/elasticsearch-suggest-plugin)
> 4. mailto:elasticsearch%2Bunsubscribe@googlegroups.com
> 5. [https://groups.google.com/d/msgid/elasticsearch/65d950a0-0784-46eb-94c3-7689ab858fe2%40googlegroups.com](https://groups.google.com/d/msgid/elasticsearch/65d950a0-0784-46eb-94c3-7689ab858fe2%40googlegroups.com)
> 6. [https://groups.google.com/groups/opt\_out](https://groups.google.com/groups/opt_out)
> 7. [https://groups.google.com/d/msgid/elasticsearch/CAGCwEM9E1D57m%2B1d8HM2jfyawo3COuadybgds2LhzoQv3Lw86w%40mail.gmail.com](https://groups.google.com/d/msgid/elasticsearch/CAGCwEM9E1D57m%2B1d8HM2jfyawo3COuadybgds2LhzoQv3Lw86w%40mail.gmail.com)
> 8. [https://groups.google.com/groups/opt\_out](https://groups.google.com/groups/opt_out)

--  
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/20131227194753.GH1363%40timac.local](https://groups.google.com/d/msgid/elasticsearch/20131227194753.GH1363%40timac.local).  
For more options, visit [https://groups.google.com/groups/opt\_out](https://groups.google.com/groups/opt_out).

---

<div class="post-metadata">

**Author:** ![Facundo\_Olano](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/facundo_olano/32/1623_2.png) [@Facundo\_Olano](https://discuss.elastic.co/u/Facundo_Olano)\
**Post date:** [December 27, 2013, 7:51pm UTC](https://discuss.elastic.co/t/completion-suggester-with-separated-doc-types-multiple-indices/15014/5 "2013-12-27T19:51:15Z")

</div>

Excellent, I was wondering about such an approach, thanks!

Facundo.

2013/12/27 Tim Bunce [Tim.Bunce@pobox.com](mailto:Tim.Bunce@pobox.com)

> Suggestion requests, including the completion suggester, operate on  
> specific field names.
> 
> So extra type-specific field names can be used to store the suggestion  
> data.
> 
> Then, to get suggestions for a particular type you'd query the  
> corresponding  
> type-specific field name.
> 
> Tim.
> 
> On Wed, Dec 25, 2013 at 01:28:50AM +0100, Alexander Reelsen wrote:
> 
> > Hey,  
> > the way the completion suggester is implemented, it does not support  
> > filtering by types (neither does  
> > the suggest plugin) - so this makes a pretty clear decision process  
> > for your use-case. The reason for  
> > this, is the different approach how suggest data is stored and  
> > queried - in a nutshell, the suggest data  
> > structure simply takes the whole index data and uses it for  
> > suggestions. The type itself is simply  
> > spoken just another metadata, which cannot be filtered out.  
> > I'd go with the completion suggester if possible (as I wrote the  
> > suggest plugin I can tell that the  
> > completion suggester has a way better design, and, obviously, is part  
> > of the core).  
> > Hope this helps...  
> > --Alex
> > 
> > On Tue, Dec 24, 2013 at 4:50 PM, Facundo Olano \<[1]  
> > [facundo.olano@gmail.com](mailto:facundo.olano@gmail.com)\> wrote:
> > 
> > ```
> > Hello, I've started playing around with the completion suggester to
> > 
> > ```
> 
> implement autocomplete
> 
> > ```
> > functionality in my application and found it pretty straightforward
> > 
> > ```
> 
> and simple to use.
> 
> > ```
> > The problem I have is that I don't want mixed types in my
> > 
> > ```
> 
> suggestions: if have a "music" index with
> 
> > ```
> > "song" and "artist" types, I want to have "song" and "artist"
> > 
> > ```
> 
> autocompletes. From the documentation I
> 
> > ```
> > get that this doesn't seem to be supported, so I'm considering
> > 
> > ```
> 
> having a separate index for each type.
> 
> > ```
> > [2]I've read that this is not the best practice, but from the size
> > 
> > ```
> 
> of my data I presume I won't be
> 
> > ```
> > having problems: I have around 10 types, most of them with around
> > 
> > ```
> 
> 2000 documents. It's worth noting
> 
> > ```
> > that I'm just using elasticsearch for this autocomplete
> > 
> > ```
> 
> functionality (although I may use it for
> 
> > ```
> > regular search eventually).
> > So I wanted to check if it makes sense modeling my indices that way
> > 
> > ```
> 
> or if there's an alternative
> 
> > ```
> > solution to my problem (for example, using the [3]suggest plugin?)
> > Thanks,
> > Facundo.
> > 
> > --
> > 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
> 
> > ```
> > [4]elasticsearch+unsubscribe@googlegroups.com.
> > To view this discussion on the web visit
> > [5]
> > 
> > ```
> 
> [https://groups.google.com/d/msgid/elasticsearch/65d950a0-0784-46eb-94c3-7689ab858fe2%40googlegroups.com](https://groups.google.com/d/msgid/elasticsearch/65d950a0-0784-46eb-94c3-7689ab858fe2%40googlegroups.com)  
> .
> 
> > ```
> > For more options, visit [6]https://groups.google.com/groups/opt_out
> > 
> > ```
> 
> .
> 
> > --  
> > 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  
> > [7]  
> > [https://groups.google.com/d/msgid/elasticsearch/CAGCwEM9E1D57m%2B1d8HM2jfyawo3COuadybgds2LhzoQv3Lw86w%40mail.gmail.com](https://groups.google.com/d/msgid/elasticsearch/CAGCwEM9E1D57m%2B1d8HM2jfyawo3COuadybgds2LhzoQv3Lw86w%40mail.gmail.com)  
> > .  
> > For more options, visit [8][https://groups.google.com/groups/opt\_out](https://groups.google.com/groups/opt_out).
> > 
> > References
> > 
> > Visible links
> > 
> > 1. [mailto:facundo.olano@gmail.com](mailto:facundo.olano@gmail.com)
> > 2.
> 
> [http://elasticsearch-users.115913.n3.nabble.com/More-indices-vs-more-types-td3999423.html#a4002051](http://elasticsearch-users.115913.n3.nabble.com/More-indices-vs-more-types-td3999423.html#a4002051)
> 
> > 1. [GitHub - spinscale/elasticsearch-suggest-plugin: Plugin for elasticsearch which uses the lucene FSTSuggester](https://github.com/spinscale/elasticsearch-suggest-plugin)
> > 2. mailto:elasticsearch%2Bunsubscribe@googlegroups.com
> > 3.
> 
> [https://groups.google.com/d/msgid/elasticsearch/65d950a0-0784-46eb-94c3-7689ab858fe2%40googlegroups.com](https://groups.google.com/d/msgid/elasticsearch/65d950a0-0784-46eb-94c3-7689ab858fe2%40googlegroups.com)
> 
> > 1. [https://groups.google.com/groups/opt\_out](https://groups.google.com/groups/opt_out)
> > 2.
> 
> [https://groups.google.com/d/msgid/elasticsearch/CAGCwEM9E1D57m%2B1d8HM2jfyawo3COuadybgds2LhzoQv3Lw86w%40mail.gmail.com](https://groups.google.com/d/msgid/elasticsearch/CAGCwEM9E1D57m%2B1d8HM2jfyawo3COuadybgds2LhzoQv3Lw86w%40mail.gmail.com)
> 
> > 1. [https://groups.google.com/groups/opt\_out](https://groups.google.com/groups/opt_out)
> 
> --  
> 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/dE1oCifOe7M/unsubscribe](https://groups.google.com/d/topic/elasticsearch/dE1oCifOe7M/unsubscribe).  
> To unsubscribe from this group and all its topics, 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/20131227194753.GH1363%40timac.local](https://groups.google.com/d/msgid/elasticsearch/20131227194753.GH1363%40timac.local)  
> .  
> For more options, visit [https://groups.google.com/groups/opt\_out](https://groups.google.com/groups/opt_out).

--  
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/CAKEP69WDdGsuTc5f%3Ds2D4z6mKWdbijbBXeaYi8RWo2XROekOCQ%40mail.gmail.com](https://groups.google.com/d/msgid/elasticsearch/CAKEP69WDdGsuTc5f%3Ds2D4z6mKWdbijbBXeaYi8RWo2XROekOCQ%40mail.gmail.com).  
For more options, visit [https://groups.google.com/groups/opt\_out](https://groups.google.com/groups/opt_out).

---

<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:59am UTC](https://discuss.elastic.co/t/completion-suggester-with-separated-doc-types-multiple-indices/15014/6 "2017-07-06T01:59:13Z")

</div>


