# Completion suggester sorting

**URL:** <https://discuss.elastic.co/t/completion-suggester-sorting/17131>\
**Category:** Elasticsearch\
**Created:** [April 22, 2014, 6:30pm UTC](https://discuss.elastic.co/t/completion-suggester-sorting/17131 "2014-04-22T18:30:11Z")\
**Posts on this page:** 4\
**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:** [April 22, 2014, 6:30pm UTC](https://discuss.elastic.co/t/completion-suggester-sorting/17131/1 "2014-04-22T18:30:11Z")

</div>

Hi, I'm using the completion suggester for an autocomplete API. I need it  
to autocomplete on middle words, so for example "Siberian Tiger" should be  
a suggestion for "tig". To accomplish that, following the documentation,  
what I do is to use multiple inputs for each term, so I index "Siberian",  
"Tiger" and also "Siberian Tiger" (so I get the result if the term is  
"siberian tig").

Now, what doesn't work entirely for me in this case is the result ordering  
I get. Assuming equal weights, for "tig" It is something like:

"Bengal Tiger"  
"Sand Tiger Shark"  
"Siberian Tiger"  
"Tiger Salamander"  
"Tiger Shark"  
"Tiger"

That is an alphabetical ordering. I'd rather like to get the terms closer  
to the input string first, like:

"Tiger"  
"Tiger Salamander"  
"Tiger Shark"  
"Bengal Tiger"  
"Sand Tiger Shark"  
"Siberian Tiger"

I realize this can't be accomplished with my current setup, but haven't  
found an alternative either, is there any?

Thanks,  
Facuindo.

--  
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/CAKEP69VwQgKtf\_iGh3a0taVP\_B80WGLbrvm88M5F1qsSopkKTg%40mail.gmail.com](https://groups.google.com/d/msgid/elasticsearch/CAKEP69VwQgKtf_iGh3a0taVP_B80WGLbrvm88M5F1qsSopkKTg%40mail.gmail.com).  
For more options, visit [https://groups.google.com/d/optout](https://groups.google.com/d/optout).

---

<div class="post-metadata">

**Author:** ![chimpsarehungry](https://avatars.discourse-cdn.com/v4/letter/c/ba8739/32.png) [@chimpsarehungry](https://discuss.elastic.co/u/chimpsarehungry)\
**Post date:** [April 22, 2014, 6:41pm UTC](https://discuss.elastic.co/t/completion-suggester-sorting/17131/2 "2014-04-22T18:41:11Z")

</div>

A prefix\_length: 1 will give you just the ones that start with T. But that  
won't really solve your problem.

--  
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/1c2f0980-8cb9-409a-aa03-b6680ee0a1ab%40googlegroups.com](https://groups.google.com/d/msgid/elasticsearch/1c2f0980-8cb9-409a-aa03-b6680ee0a1ab%40googlegroups.com).  
For more options, visit [https://groups.google.com/d/optout](https://groups.google.com/d/optout).

---

<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:** [April 26, 2014, 12:05am UTC](https://discuss.elastic.co/t/completion-suggester-sorting/17131/3 "2014-04-26T00:05:40Z")

</div>

Hey,

could you possible use different weights to have your custom scoring? That  
might be possible when you are using an own index for suggestions, so you  
could have more inputs.

--Alex

On Tue, Apr 22, 2014 at 2:41 PM, Shane Neeley [sneeley@molecularmatch.com](mailto:sneeley@molecularmatch.com)wrote:

> A prefix\_length: 1 will give you just the ones that start with T. But that  
> won't really solve your problem.
> 
> --  
> 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/1c2f0980-8cb9-409a-aa03-b6680ee0a1ab%40googlegroups.com](https://groups.google.com/d/msgid/elasticsearch/1c2f0980-8cb9-409a-aa03-b6680ee0a1ab%40googlegroups.com)[https://groups.google.com/d/msgid/elasticsearch/1c2f0980-8cb9-409a-aa03-b6680ee0a1ab%40googlegroups.com?utm\_medium=email&utm\_source=footer](https://groups.google.com/d/msgid/elasticsearch/1c2f0980-8cb9-409a-aa03-b6680ee0a1ab%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/CAGCwEM-Knf2%2BokCZ8zma6yBdwo8n9hwvhJ89DmfRESc64vOxaQ%40mail.gmail.com](https://groups.google.com/d/msgid/elasticsearch/CAGCwEM-Knf2%2BokCZ8zma6yBdwo8n9hwvhJ89DmfRESc64vOxaQ%40mail.gmail.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:33am UTC](https://discuss.elastic.co/t/completion-suggester-sorting/17131/4 "2017-07-06T01:33:24Z")

</div>


