Auto Complete Elastic search


(paul) #1

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.
For more options, visit https://groups.google.com/groups/opt_out.


(Andrej) #2

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.
For more options, visit https://groups.google.com/groups/opt_out.


(paul) #3

Hi Andrej,

The query i used is 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.
For more options, visit https://groups.google.com/groups/opt_out.


(Andrej) #4

Hi Paul,

first, this is a theorie, no valid answer :wink:

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.
For more options, visit https://groups.google.com/groups/opt_out.


(system) #5