# Autocomplete rest of query: Do not propose shorter queries?

**URL:** <https://discuss.elastic.co/t/autocomplete-rest-of-query-do-not-propose-shorter-queries/16504>\
**Category:** Elasticsearch\
**Created:** [March 20, 2014, 6:29pm UTC](https://discuss.elastic.co/t/autocomplete-rest-of-query-do-not-propose-shorter-queries/16504 "2014-03-20T18:29:48Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![Steven](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/steven/32/43164_2.png) [@Steven](https://discuss.elastic.co/u/Steven)\
**Post date:** [March 20, 2014, 6:29pm UTC](https://discuss.elastic.co/t/autocomplete-rest-of-query-do-not-propose-shorter-queries/16504/1 "2014-03-20T18:29:48Z")

</div>

Hi Everyone,

I have put together some auto complete functionality based around the blog  
posted on ES page ([http://www.elasticsearch.org/blog/you-complete-me/](http://www.elasticsearch.org/blog/you-complete-me/)). I  
use the following to create the index.

PUT test\_index  
{  
"mappings": {  
"query" : {  
"properties" : {  
"product" : { "type" : "string" },  
"name\_suggest" : {  
"type" : "completion"  
}  
}  
}  
}

Everything works fine except for 1 experience issue. That is for example if  
I search for xbox 360, xbox one is also considered a relevant suggestion. I  
would prefer if the autocomplete terms returned only contained the previous  
characters entered for the search. For example xbox 360 xbox 360 controller  
etc. The index contains a list of search terms.

Can anyone suggest ways of doing this? Very unfamiliar with the ES API.

--  
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/eece9c6f-75be-4046-9af1-b279a23a3ed6%40googlegroups.com](https://groups.google.com/d/msgid/elasticsearch/eece9c6f-75be-4046-9af1-b279a23a3ed6%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:** [March 31, 2014, 7:15am UTC](https://discuss.elastic.co/t/autocomplete-rest-of-query-do-not-propose-shorter-queries/16504/2 "2014-03-31T07:15:08Z")

</div>

Hey,

can you create a gist as an example, how you are indexing your data? My  
assumption is, that you may want to use the whitespace analyzer instead of  
the simple analyzer, as that one removes numbers. So your query "xbox 360"  
becomes "xbox" and therefore "xbox one" is returned as well.

--Alex

On Thu, Mar 20, 2014 at 7:29 PM, Steven [sbourke@gmail.com](mailto:sbourke@gmail.com) wrote:

> Hi Everyone,
> 
> I have put together some auto complete functionality based around the blog  
> posted on ES page ([Elasticsearch Platform — Find real-time answers at scale | Elastic](http://www.elasticsearch.org/blog/you-complete-me/)). I  
> use the following to create the index.
> 
> PUT test\_index  
> {  
> "mappings": {  
> "query" : {  
> "properties" : {  
> "product" : { "type" : "string" },  
> "name\_suggest" : {  
> "type" : "completion"  
> }  
> }  
> }  
> }
> 
> Everything works fine except for 1 experience issue. That is for example  
> if I search for xbox 360, xbox one is also considered a relevant  
> suggestion. I would prefer if the autocomplete terms returned only  
> contained the previous characters entered for the search. For example xbox  
> 360 xbox 360 controller etc. The index contains a list of search terms.
> 
> Can anyone suggest ways of doing this? Very unfamiliar with the ES API.
> 
> --  
> 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/eece9c6f-75be-4046-9af1-b279a23a3ed6%40googlegroups.com](https://groups.google.com/d/msgid/elasticsearch/eece9c6f-75be-4046-9af1-b279a23a3ed6%40googlegroups.com)[https://groups.google.com/d/msgid/elasticsearch/eece9c6f-75be-4046-9af1-b279a23a3ed6%40googlegroups.com?utm\_medium=email&utm\_source=footer](https://groups.google.com/d/msgid/elasticsearch/eece9c6f-75be-4046-9af1-b279a23a3ed6%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/CAGCwEM9FvwPXkJCkAXRfL6yYAjBMt%2BhDuuFnXbnu%2BR%3DS5Xk\_\_g%40mail.gmail.com](https://groups.google.com/d/msgid/elasticsearch/CAGCwEM9FvwPXkJCkAXRfL6yYAjBMt%2BhDuuFnXbnu%2BR%3DS5Xk__g%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:39am UTC](https://discuss.elastic.co/t/autocomplete-rest-of-query-do-not-propose-shorter-queries/16504/3 "2017-07-06T01:39:33Z")

</div>


