# AutoComplete

**URL:** <https://discuss.elastic.co/t/autocomplete/15295>\
**Category:** Elasticsearch\
**Created:** [January 17, 2014, 1:15pm UTC](https://discuss.elastic.co/t/autocomplete/15295 "2014-01-17T13:15:16Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![paul1](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/paul1/32/46819_2.png) [@paul1](https://discuss.elastic.co/u/paul1)\
**Post date:** [January 17, 2014, 1:15pm UTC](https://discuss.elastic.co/t/autocomplete/15295/1 "2014-01-17T13:15:16Z")

</div>

Hi I am trying out auto-complete below is my mapping

{  
"settings":{  
"analysis":{  
"filter":{  
"syns\_filter":{  
"synonyms\_path":"synonyms/synonym\_country.txt",  
"type":"synonym",  
"ignore\_case":true  
},  
"my\_edgeNgram":{  
"type":"edgeNGram",  
"min\_gram":3,  
"max\_gram":10  
}  
},  
"analyzer":{  
"autocomplete":{  
"type":"custom",  
"tokenizer":"standard",  
"filter":[  
"standard",  
"lowercase",  
"syns\_filter",  
"stop",  
"my\_edgeNgram"  
]  
}  
},  
"mappings":{  
"autotest":{  
"properties":{  
"name":{  
"type":"string",  
"analyzer":"autocomplete"  
}  
}  
}  
}  
}  
}  
}

When i Type "Massachusett"

I get the list of colleges That has "Massachusetts" in there name like

"Massachusetts Bay Community College"  
"Middlesex Community College - Massachusetts"  
"Springfield College - Massachusetts"  
"Massachusetts Institute of Technology"  
"Massachusetts School of Barbering"

But i want the college names that start with "Massachusetts" to come on top  
I even tried ngram but still same behavior

Regards  
Paul

--  
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/a12674e4-ee39-4ce3-9ebc-af6f98263df4%40googlegroups.com](https://groups.google.com/d/msgid/elasticsearch/a12674e4-ee39-4ce3-9ebc-af6f98263df4%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:** ![Amit\_Soni](https://avatars.discourse-cdn.com/v4/letter/a/c0e974/32.png) [@Amit\_Soni](https://discuss.elastic.co/u/Amit_Soni)\
**Post date:** [January 17, 2014, 6:40pm UTC](https://discuss.elastic.co/t/autocomplete/15295/2 "2014-01-17T18:40:37Z")

</div>

did you try n-gram or edge n-gram?

-Amit.

On Fri, Jan 17, 2014 at 5:15 AM, paul [avinashpaul85@gmail.com](mailto:avinashpaul85@gmail.com) wrote:

> Hi I am trying out auto-complete below is my mapping
> 
> {  
> "settings":{  
> "analysis":{  
> "filter":{  
> "syns\_filter":{  
> "synonyms\_path":"synonyms/synonym\_country.txt",  
> "type":"synonym",  
> "ignore\_case":true  
> },  
> "my\_edgeNgram":{  
> "type":"edgeNGram",  
> "min\_gram":3,  
> "max\_gram":10  
> }  
> },  
> "analyzer":{  
> "autocomplete":{  
> "type":"custom",  
> "tokenizer":"standard",  
> "filter":[  
> "standard",  
> "lowercase",  
> "syns\_filter",  
> "stop",  
> "my\_edgeNgram"  
> ]  
> }  
> },  
> "mappings":{  
> "autotest":{  
> "properties":{  
> "name":{  
> "type":"string",  
> "analyzer":"autocomplete"  
> }  
> }  
> }  
> }  
> }  
> }  
> }
> 
> When i Type "Massachusett"
> 
> I get the list of colleges That has "Massachusetts" in there name like
> 
> "Massachusetts Bay Community College"  
> "Middlesex Community College - Massachusetts"  
> "Springfield College - Massachusetts"  
> "Massachusetts Institute of Technology"  
> "Massachusetts School of Barbering"
> 
> But i want the college names that start with "Massachusetts" to come on  
> top  
> I even tried ngram but still same behavior
> 
> Regards  
> Paul
> 
> --  
> 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/a12674e4-ee39-4ce3-9ebc-af6f98263df4%40googlegroups.com](https://groups.google.com/d/msgid/elasticsearch/a12674e4-ee39-4ce3-9ebc-af6f98263df4%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/CAAOGaQKLh2\_bX-o2W%3D4n9h3AEOSGMgf4y00w5p-ZTOEUOtG-kg%40mail.gmail.com](https://groups.google.com/d/msgid/elasticsearch/CAAOGaQKLh2_bX-o2W%3D4n9h3AEOSGMgf4y00w5p-ZTOEUOtG-kg%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:** ![paul1](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/paul1/32/46819_2.png) [@paul1](https://discuss.elastic.co/u/paul1)\
**Post date:** [January 18, 2014, 11:55am UTC](https://discuss.elastic.co/t/autocomplete/15295/3 "2014-01-18T11:55:34Z")

</div>

Tried both I also have synonymous in my mapping is that causing the problem  
On 18 Jan 2014 00:11, "Amit Soni" [amitsoni29@gmail.com](mailto:amitsoni29@gmail.com) wrote:

> did you try n-gram or edge n-gram?
> 
> -Amit.
> 
> On Fri, Jan 17, 2014 at 5:15 AM, paul [avinashpaul85@gmail.com](mailto:avinashpaul85@gmail.com) wrote:
> 
> > Hi I am trying out auto-complete below is my mapping
> > 
> > {  
> > "settings":{  
> > "analysis":{  
> > "filter":{  
> > "syns\_filter":{  
> > "synonyms\_path":"synonyms/synonym\_country.txt",  
> > "type":"synonym",  
> > "ignore\_case":true  
> > },  
> > "my\_edgeNgram":{  
> > "type":"edgeNGram",  
> > "min\_gram":3,  
> > "max\_gram":10  
> > }  
> > },  
> > "analyzer":{  
> > "autocomplete":{  
> > "type":"custom",  
> > "tokenizer":"standard",  
> > "filter":[  
> > "standard",  
> > "lowercase",  
> > "syns\_filter",  
> > "stop",  
> > "my\_edgeNgram"  
> > ]  
> > }  
> > },  
> > "mappings":{  
> > "autotest":{  
> > "properties":{  
> > "name":{  
> > "type":"string",  
> > "analyzer":"autocomplete"  
> > }  
> > }  
> > }  
> > }  
> > }  
> > }  
> > }
> > 
> > When i Type "Massachusett"
> > 
> > I get the list of colleges That has "Massachusetts" in there name like
> > 
> > "Massachusetts Bay Community College"  
> > "Middlesex Community College - Massachusetts"  
> > "Springfield College - Massachusetts"  
> > "Massachusetts Institute of Technology"  
> > "Massachusetts School of Barbering"
> > 
> > But i want the college names that start with "Massachusetts" to come on  
> > top  
> > I even tried ngram but still same behavior
> > 
> > Regards  
> > Paul
> > 
> > --  
> > 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/a12674e4-ee39-4ce3-9ebc-af6f98263df4%40googlegroups.com](https://groups.google.com/d/msgid/elasticsearch/a12674e4-ee39-4ce3-9ebc-af6f98263df4%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 a topic in the  
> Google Groups "elasticsearch" group.  
> To unsubscribe from this topic, visit  
> [https://groups.google.com/d/topic/elasticsearch/seIEZxxPE-4/unsubscribe](https://groups.google.com/d/topic/elasticsearch/seIEZxxPE-4/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/CAAOGaQKLh2\_bX-o2W%3D4n9h3AEOSGMgf4y00w5p-ZTOEUOtG-kg%40mail.gmail.com](https://groups.google.com/d/msgid/elasticsearch/CAAOGaQKLh2_bX-o2W%3D4n9h3AEOSGMgf4y00w5p-ZTOEUOtG-kg%40mail.gmail.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/CAO066G257oLhzCsEpyMroMh2EbnJuxvOBtUr7wvnDOdBVqeQ1w%40mail.gmail.com](https://groups.google.com/d/msgid/elasticsearch/CAO066G257oLhzCsEpyMroMh2EbnJuxvOBtUr7wvnDOdBVqeQ1w%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:** ![paul1](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/paul1/32/46819_2.png) [@paul1](https://discuss.elastic.co/u/paul1)\
**Post date:** [January 20, 2014, 5:42am UTC](https://discuss.elastic.co/t/autocomplete/15295/4 "2014-01-20T05:42:33Z")

</div>

I think if we can boos the results by word position we can solve this issue  
, Is there a way to boost the result by the position of the word occurred.

-paul

On Saturday, 18 January 2014 17:25:34 UTC+5:30, paul wrote:

> Tried both I also have synonymous in my mapping is that causing the problem  
> On 18 Jan 2014 00:11, "Amit Soni" [amitsoni29@gmail.com](mailto:amitsoni29@gmail.com) wrote:
> 
> > did you try n-gram or edge n-gram?
> > 
> > -Amit.
> > 
> > On Fri, Jan 17, 2014 at 5:15 AM, paul [avinashpaul85@gmail.com](mailto:avinashpaul85@gmail.com) wrote:
> > 
> > > Hi I am trying out auto-complete below is my mapping
> > > 
> > > {  
> > > "settings":{  
> > > "analysis":{  
> > > "filter":{  
> > > "syns\_filter":{  
> > > "synonyms\_path":"synonyms/synonym\_country.txt",  
> > > "type":"synonym",  
> > > "ignore\_case":true  
> > > },  
> > > "my\_edgeNgram":{  
> > > "type":"edgeNGram",  
> > > "min\_gram":3,  
> > > "max\_gram":10  
> > > }  
> > > },  
> > > "analyzer":{  
> > > "autocomplete":{  
> > > "type":"custom",  
> > > "tokenizer":"standard",  
> > > "filter":[  
> > > "standard",  
> > > "lowercase",  
> > > "syns\_filter",  
> > > "stop",  
> > > "my\_edgeNgram"  
> > > ]  
> > > }  
> > > },  
> > > "mappings":{  
> > > "autotest":{  
> > > "properties":{  
> > > "name":{  
> > > "type":"string",  
> > > "analyzer":"autocomplete"  
> > > }  
> > > }  
> > > }  
> > > }  
> > > }  
> > > }  
> > > }
> > > 
> > > When i Type "Massachusett"
> > > 
> > > I get the list of colleges That has "Massachusetts" in there name like
> > > 
> > > "Massachusetts Bay Community College"  
> > > "Middlesex Community College - Massachusetts"  
> > > "Springfield College - Massachusetts"  
> > > "Massachusetts Institute of Technology"  
> > > "Massachusetts School of Barbering"
> > > 
> > > But i want the college names that start with "Massachusetts" to come on  
> > > top  
> > > I even tried ngram but still same behavior
> > > 
> > > Regards  
> > > Paul
> > > 
> > > --  
> > > 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/a12674e4-ee39-4ce3-9ebc-af6f98263df4%40googlegroups.com](https://groups.google.com/d/msgid/elasticsearch/a12674e4-ee39-4ce3-9ebc-af6f98263df4%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 a topic in the  
> > Google Groups "elasticsearch" group.  
> > To unsubscribe from this topic, visit  
> > [https://groups.google.com/d/topic/elasticsearch/seIEZxxPE-4/unsubscribe](https://groups.google.com/d/topic/elasticsearch/seIEZxxPE-4/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/CAAOGaQKLh2\_bX-o2W%3D4n9h3AEOSGMgf4y00w5p-ZTOEUOtG-kg%40mail.gmail.com](https://groups.google.com/d/msgid/elasticsearch/CAAOGaQKLh2_bX-o2W%3D4n9h3AEOSGMgf4y00w5p-ZTOEUOtG-kg%40mail.gmail.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/07f3f7ba-434c-40fd-a51a-c70309e5eb44%40googlegroups.com](https://groups.google.com/d/msgid/elasticsearch/07f3f7ba-434c-40fd-a51a-c70309e5eb44%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:** ![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:55am UTC](https://discuss.elastic.co/t/autocomplete/15295/5 "2017-07-06T01:55:57Z")

</div>


