# \[ES - 1.0.0\] Trouble doing a split match with edgeNgram

**URL:** <https://discuss.elastic.co/t/es-1-0-0-trouble-doing-a-split-match-with-edgengram/16298>\
**Category:** Elasticsearch\
**Created:** [March 11, 2014, 8:27pm UTC](https://discuss.elastic.co/t/es-1-0-0-trouble-doing-a-split-match-with-edgengram/16298 "2014-03-11T20:27:14Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![11140](https://avatars.discourse-cdn.com/v4/letter/1/e56c9b/32.png) [@11140](https://discuss.elastic.co/u/11140)\
**Post date:** [March 11, 2014, 8:27pm UTC](https://discuss.elastic.co/t/es-1-0-0-trouble-doing-a-split-match-with-edgengram/16298/1 "2014-03-11T20:27:14Z")

</div>

Hi,

I am trying to query for "fit pro" against my index where there is a  
document with "fitpro" on one of its fields. Decided to take the following  
approach with it:

- Create a reverse edgeNgram tokenizer
- Used the edgeNgram tokenizer only of index\_analyzer
- Boost on match prefix and match (edgeNgram field)

Am getting the result after couple of hits down the list. Playing with the  
weights is not changing much 😕

Any help would be much appreciated.

Index mapping is -

'settings':{  
'number\_of\_shards': 1,  
'number\_of\_replicas': 0,  
"analysis": {  
"filter" : {  
"filter\_edgeNgram" : {  
"type" : "edgeNGram",  
"min\_gram" : "3",  
"max\_gram" : "6",  
"token\_chars": ["letter", "digit"]  
}  
},  
"analyzer": {  
"analyzer\_ngram\_rev" : {  
"type":"custom",  
"tokenizer": "standard",  
"filter": ["standard", "lowercase", "asciifolding", "reverse",  
"filter\_edgeNgram", "reverse"]  
},  
"analyzer\_stemmed" : {  
"tokenizer":"standard",  
"filter":["standard", "lowercase", "asciifolding", "kstem"]  
}  
}  
}  
}  
},  
ignore=400

Query is -

{  
"from" : 0,  
"size" : 60,  
"query" : {  
"function\_score" : {  
"query" : {  
"filtered" : {  
"query" : {  
"bool" : {  
"should" : [ {  
"query\_string" : {  
"query" : "fit~1 pro~1 ",  
"minimum\_should\_match" : "60%"  
}  
}, {  
"match" : {  
"name" : {  
"query" : "fit",  
"type" : "phrase\_prefix"  
}  
}  
}, {  
"match" : {  
"name\_ngram\_fwd" : {  
"query" : "fit pro",  
"type" : "boolean"  
}  
}  
}, {  
"match" : {  
"name\_stemmed" : {  
"query" : "fit pro",  
"type" : "boolean"  
}  
}  
} ]  
}  
},  
"filter" : {  
"geo\_distance" : {  
"location" : [41.880001068115234, -87.62000274658203],  
"distance" : "16km"  
}  
}  
}  
},  
"functions" : [ {  
"filter" : {  
"geo\_distance" : {  
"location" : [41.880001068115234, -87.62000274658203],  
"distance" : "16km"  
}  
},  
"boost\_factor" : 2.0  
}, {  
"filter" : {  
"query" : {  
"query\_string" : {  
"query" : "fit~1 pro~1 ",  
"minimum\_should\_match" : "60%"  
}  
}  
},  
"boost\_factor" : 1.0  
}, {  
"filter" : {  
"query" : {  
"match" : {  
"name" : {  
"query" : "fit",  
"type" : "phrase\_prefix"  
}  
}  
}  
},  
"boost\_factor" : 4.0  
}, {  
"filter" : {  
"query" : {  
"match" : {  
"name\_ngram\_rev" : {  
"query" : "fit pro"  
}  
}  
}  
},  
"boost\_factor" : 6.0  
}, {  
"filter" : {  
"query" : {  
"query\_string" : {  
"query" : "fit pro"  
}  
}  
},  
"boost\_factor" : 2.0  
} ],  
"score\_mode" : "multiply"  
}  
},  
"fields" : "\_source",  
"script\_fields" : {  
"distance" : {  
"script" : "doc['location'].distanceInKm(41.880001,-87.620003)"  
}  
}  
}

--  
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/9fefa584-ee2f-42e1-ae38-6fa494df5ddd%40googlegroups.com](https://groups.google.com/d/msgid/elasticsearch/9fefa584-ee2f-42e1-ae38-6fa494df5ddd%40googlegroups.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:44am UTC](https://discuss.elastic.co/t/es-1-0-0-trouble-doing-a-split-match-with-edgengram/16298/2 "2017-07-06T01:44:08Z")

</div>


