# Auto Complete Elastic search

**URL:** <https://discuss.elastic.co/t/auto-complete-elastic-search/14403>\
**Category:** Elasticsearch\
**Created:** [November 14, 2013, 11:36am UTC](https://discuss.elastic.co/t/auto-complete-elastic-search/14403 "2013-11-14T11:36:19Z")\
**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:** [November 14, 2013, 11:36am UTC](https://discuss.elastic.co/t/auto-complete-elastic-search/14403/1 "2013-11-14T11:36:19Z")

</div>

How to send space in auto complete quires.

My Mapping and setting is as below

{  
"settings":{  
"index":{  
"analysis":{  
"analyzer":{  
"autocomplete":{  
"tokenizer":"engram",  
"filter":[  
"lowercase"  
]  
}  
},  
"tokenizer":{  
"engram":{  
"type":"edgeNGram",  
"min\_gram":3,  
"max\_gram":10  
}  
}  
}  
}  
},  
"mappings":{  
"collegeName":{  
"properties":{  
"title":{  
"type":"string",  
"index\_analyzer":"autocomplete",  
"index":"analyzed",  
"search\_analyzer":"standard"  
}  
}  
}  
}  
}

data in ES

{  
"title":"mandala tech"

}

{  
"title":"Mass Institute Technology"

}

{  
"title":"Massach Institute of tech"

}

When i query as q=title:"Mass" i get the below results which is fine

- "Massach Institute of tech"
- "Mass Institute Technology"

When i query as q=title:"Mass I" i still get the below results but it  
should be only one.

- "Massach Institute of tech"
- "Mass Institute Technology"

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).  
For more options, visit [https://groups.google.com/groups/opt\_out](https://groups.google.com/groups/opt_out).

---

<div class="post-metadata">

**Author:** ![Andrej](https://avatars.discourse-cdn.com/v4/letter/a/d9b06d/32.png) [@Andrej](https://discuss.elastic.co/u/Andrej)\
**Post date:** [November 14, 2013, 12:55pm UTC](https://discuss.elastic.co/t/auto-complete-elastic-search/14403/2 "2013-11-14T12:55:13Z")

</div>

Hi Paul,

could you provide the query you use?

Greets  
Andrej

Am Donnerstag, 14. November 2013 12:36:19 UTC+1 schrieb paul:

> How to send space in auto complete quires.
> 
> My Mapping and setting is as below
> 
> {  
> "settings":{  
> "index":{  
> "analysis":{  
> "analyzer":{  
> "autocomplete":{  
> "tokenizer":"engram",  
> "filter":[  
> "lowercase"  
> ]  
> }  
> },  
> "tokenizer":{  
> "engram":{  
> "type":"edgeNGram",  
> "min\_gram":3,  
> "max\_gram":10  
> }  
> }  
> }  
> }  
> },  
> "mappings":{  
> "collegeName":{  
> "properties":{  
> "title":{  
> "type":"string",  
> "index\_analyzer":"autocomplete",  
> "index":"analyzed",  
> "search\_analyzer":"standard"  
> }  
> }  
> }  
> }  
> }
> 
> data in ES
> 
> {  
> "title":"mandala tech"
> 
> }
> 
> {  
> "title":"Mass Institute Technology"
> 
> }
> 
> {  
> "title":"Massach Institute of tech"
> 
> }
> 
> When i query as q=title:"Mass" i get the below results which is fine
> 
> - "Massach Institute of tech"
> - "Mass Institute Technology"
> 
> When i query as q=title:"Mass I" i still get the below results but it  
> should be only one.
> 
> - "Massach Institute of tech"
> - "Mass Institute Technology"
> 
> 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).  
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:** [November 14, 2013, 2:11pm UTC](https://discuss.elastic.co/t/auto-complete-elastic-search/14403/3 "2013-11-14T14:11:14Z")

</div>

Hi Andrej,

The query i used is [http://localhost:9200/coll/name/\_search?q=title:](http://localhost:9200/coll/name/_search?q=title:)"Mass I"

On Thursday, 14 November 2013 18:25:13 UTC+5:30, Andrej Rosenheinrich wrote:

> Hi Paul,
> 
> could you provide the query you use?
> 
> Greets  
> Andrej
> 
> Am Donnerstag, 14. November 2013 12:36:19 UTC+1 schrieb paul:
> 
> > How to send space in auto complete quires.
> > 
> > My Mapping and setting is as below
> > 
> > {  
> > "settings":{  
> > "index":{  
> > "analysis":{  
> > "analyzer":{  
> > "autocomplete":{  
> > "tokenizer":"engram",  
> > "filter":[  
> > "lowercase"  
> > ]  
> > }  
> > },  
> > "tokenizer":{  
> > "engram":{  
> > "type":"edgeNGram",  
> > "min\_gram":3,  
> > "max\_gram":10  
> > }  
> > }  
> > }  
> > }  
> > },  
> > "mappings":{  
> > "collegeName":{  
> > "properties":{  
> > "title":{  
> > "type":"string",  
> > "index\_analyzer":"autocomplete",  
> > "index":"analyzed",  
> > "search\_analyzer":"standard"  
> > }  
> > }  
> > }  
> > }  
> > }
> > 
> > data in ES
> > 
> > {  
> > "title":"mandala tech"
> > 
> > }
> > 
> > {  
> > "title":"Mass Institute Technology"
> > 
> > }
> > 
> > {  
> > "title":"Massach Institute of tech"
> > 
> > }
> > 
> > When i query as q=title:"Mass" i get the below results which is fine
> > 
> > - "Massach Institute of tech"
> > - "Mass Institute Technology"
> > 
> > When i query as q=title:"Mass I" i still get the below results but it  
> > should be only one.
> > 
> > - "Massach Institute of tech"
> > - "Mass Institute Technology"
> > 
> > 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).  
For more options, visit [https://groups.google.com/groups/opt\_out](https://groups.google.com/groups/opt_out).

---

<div class="post-metadata">

**Author:** ![Andrej](https://avatars.discourse-cdn.com/v4/letter/a/d9b06d/32.png) [@Andrej](https://discuss.elastic.co/u/Andrej)\
**Post date:** [November 14, 2013, 5:44pm UTC](https://discuss.elastic.co/t/auto-complete-elastic-search/14403/4 "2013-11-14T17:44:49Z")

</div>

Hi Paul,

first, this is a theorie, no valid answer 😉

I would guess it it down to the way you query the index. You use uri  
search, so look at Query String Query. Query String Query uses Query String  
syntax, and there in the docs is written: "The query string is parsed into  
a series of _terms_ and _operators_. A term can be a single word — quick or  
brown — or a phrase, surrounded by double quotes — "quick brown" — which  
searches for all the words in the phrase, in the same order."  
So, if I understand it right your query aint for one term "Mass I" but for  
two, "Mass" and "I". Still, I am not completely sure to what kind of query  
it is transformed and why you get a result at all. May be you could run it  
with explain option?

Greets  
Andrej

Am Donnerstag, 14. November 2013 12:36:19 UTC+1 schrieb paul:

> How to send space in auto complete quires.
> 
> My Mapping and setting is as below
> 
> {  
> "settings":{  
> "index":{  
> "analysis":{  
> "analyzer":{  
> "autocomplete":{  
> "tokenizer":"engram",  
> "filter":[  
> "lowercase"  
> ]  
> }  
> },  
> "tokenizer":{  
> "engram":{  
> "type":"edgeNGram",  
> "min\_gram":3,  
> "max\_gram":10  
> }  
> }  
> }  
> }  
> },  
> "mappings":{  
> "collegeName":{  
> "properties":{  
> "title":{  
> "type":"string",  
> "index\_analyzer":"autocomplete",  
> "index":"analyzed",  
> "search\_analyzer":"standard"  
> }  
> }  
> }  
> }  
> }
> 
> data in ES
> 
> {  
> "title":"mandala tech"
> 
> }
> 
> {  
> "title":"Mass Institute Technology"
> 
> }
> 
> {  
> "title":"Massach Institute of tech"
> 
> }
> 
> When i query as q=title:"Mass" i get the below results which is fine
> 
> - "Massach Institute of tech"
> - "Mass Institute Technology"
> 
> When i query as q=title:"Mass I" i still get the below results but it  
> should be only one.
> 
> - "Massach Institute of tech"
> - "Mass Institute Technology"
> 
> 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).  
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, 2:06am UTC](https://discuss.elastic.co/t/auto-complete-elastic-search/14403/5 "2017-07-06T02:06:57Z")

</div>


