Hello All,
I am wondering, how to rank an exact match higher than the ngram matches.
For instance:
If I search for asus
It scores higher casual than asus or if I search for app it gives me first laptop and than it gives me apple
Settings
{
"settings": {
"index":{
"max_ngram_diff": 20
},
"analysis": {
"analyzer": {
"my_analyzer": {
"type":"custom",
"tokenizer": "my_tokenizer"
}
},
"tokenizer": {
"my_tokenizer": {
"type": "ngram",
"min_gram": 2 ,
"max_gram": 20
}
}
}
}
}
Mapping
{
"properties" : {
"analyzedName" : {
"type" : "nested",
"properties" : {
"text" : {
"type" : "text",
"analyzer" : "my_analyzer"
}
}
}
}
}
Query
{
"query": {
"nested" : {
"path" : "analyzedName",
"query" : {
"bool" : {
"must" : [
{ "match" : {"analyzedName.text" : "app"} }
]
}
}
}
}
}