# Why is an exact match coming up second?

**URL:** <https://discuss.elastic.co/t/why-is-an-exact-match-coming-up-second/70986>\
**Category:** Elasticsearch\
**Created:** [January 9, 2017, 7:16pm UTC](https://discuss.elastic.co/t/why-is-an-exact-match-coming-up-second/70986 "2017-01-09T19:16:59Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![Airn5475](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/airn5475/32/13757_2.png) [@Airn5475](https://discuss.elastic.co/u/Airn5475)\
**Post date:** [January 9, 2017, 7:16pm UTC](https://discuss.elastic.co/t/why-is-an-exact-match-coming-up-second/70986/1 "2017-01-09T19:16:59Z")

</div>

I am using edge ngrams on a field that I am querying.

I have two companies, one called "buckhead's" and the other is just "buckhead".  
When I do a basic query for the phrase "buckhead", I would expect the exact match to appear first, but it's not. It's second.  
I ran the query with `explain` enabled and there is one field that is different that I can't find an explanation regarding what it is for. The field is `avgFieldLength`. (If someone has a link that explains that field, I would appreciate it.) The `details\value`is also different and assuming that has a factor. Again, not sure what this means.

**Why is the exact match #2 in the results?**

I tried to post as much info as possible, but the 6k limit dinged me. Let me know what you need.

here's the mapping for the column:

"mappings": {  
"company": {  
"properties": {  
"DbaName": {  
"type": "text",  
"analyzer": "autocomplete",  
"search\_analyzer": "standard",  
"fields": {  
"keyword": {  
"type": "keyword",  
"ignore\_above": 256  
}}},

here's the query:

GET companies/company/\_search  
{  
"\_source": ["DbaName"],  
"query": {  
"match": {  
"DbaName": {  
"query": "buckhead",  
"analyzer":"standard"  
}}}}

here's the results with explanation:

{  
"hits": {  
"total": 98,  
"max\_score": 13.999463,  
"hits": [  
{  
"\_score": 13.999463,  
"\_source": { "DbaName": "Buckhead's" },  
"\_explanation": {  
"value": 13.999462,  
"description": "sum of:",  
"details": [  
{  
"value": 13.999462,  
"description": "weight(DbaName:buckhead in 27513) [PerFieldSimilarity], result of:",  
"details": [  
{  
"value": 13.999462,  
"description": "score(doc=27513,freq=1.0 = termFreq=1.0\n), product of:",  
"details": [  
{  
**"value": 8.614753,**  
"description": "idf(docFreq=28, docCount=157102)",  
"details": []  
},  
{  
"value": 1.6250567,  
"description": "tfNorm, computed from:",  
"details": [  
{  
"value": 1,  
"description": "termFreq=1.0",  
"details": []  
},  
{  
"value": 1.2,  
"description": "parameter k1",  
"details": []  
},  
{  
"value": 0.75,  
"description": "parameter b",  
"details": []  
},  
{  
**"value": 16.728985,**  
**"description": "avgFieldLength",**  
"details": []  
},  
{  
"value": 1,  
"description": "fieldLength",  
"details": []  
}  
]  
}  
]  
}  
]  
},  
{  
"value": 0,  
"description": "match on required clause, product of:",  
"details": [  
{  
"value": 0,  
"description": "# clause",  
"details": []  
},  
{  
"value": 1,  
"description": "_:_, product of:",  
"details": [  
{  
"value": 1,  
"description": "boost",  
"details": []  
},  
{  
"value": 1,  
"description": "queryNorm",  
"details": []  
}  
]  
}  
]  
}  
]  
}  
},  
{  
"\_source": { "DbaName": "Buckhead" },  
"\_explanation": {  
"value": 13.82115,  
"description": "sum of:",  
"details": [  
{  
"value": 13.82115,  
"description": "weight(DbaName:buckhead in 23242) [PerFieldSimilarity], result of:",  
"details": [  
{  
"value": 13.82115,  
"description": "score(doc=23242,freq=1.0 = termFreq=1.0\n), product of:",  
"details": [  
{  
**"value": 8.506051,**  
"description": "idf(docFreq=28, docCount=140920)",  
"details": []  
},  
{  
"value": 1.6248609,  
"description": "tfNorm, computed from:",  
"details": [  
{  
"value": 1,  
"description": "termFreq=1.0",  
"details": []  
},  
{  
"value": 1.2,  
"description": "parameter k1",  
"details": []  
},  
{  
"value": 0.75,  
"description": "parameter b",  
"details": []  
},  
{  
**"value": 16.678392,**  
**"description": "avgFieldLength",**  
"details": []  
},  
{  
"value": 1,  
"description": "fieldLength",  
"details": []  
}  
]  
}  
]  
}  
]  
},  
{  
"value": 0,  
"description": "match on required clause, product of:",  
"details": [  
{  
"value": 0,  
"description": "# clause",  
"details": []  
},  
{  
"value": 1,  
"description": "_:_, product of:",  
"details": [  
{  
"value": 1,  
"description": "boost",  
"details": []  
},  
{  
"value": 1,  
"description": "queryNorm",  
"details": []  
}  
]  
}  
]  
}  
]  
}  
}

---

<div class="post-metadata">

**Author:** ![forloop](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/forloop/32/9021_2.png) [@forloop](https://discuss.elastic.co/u/forloop)\
**Post date:** [January 10, 2017, 1:11am UTC](https://discuss.elastic.co/t/why-is-an-exact-match-coming-up-second/70986/2 "2017-01-10T01:11:14Z")

</div>

what version of Elasticsearch are you using?

---

<div class="post-metadata">

**Author:** ![Airn5475](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/airn5475/32/13757_2.png) [@Airn5475](https://discuss.elastic.co/u/Airn5475)\
**Post date:** [January 10, 2017, 1:06pm UTC](https://discuss.elastic.co/t/why-is-an-exact-match-coming-up-second/70986/3 "2017-01-10T13:06:07Z")

</div>

Version 5.1.1

---

<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:** [February 7, 2017, 1:06pm UTC](https://discuss.elastic.co/t/why-is-an-exact-match-coming-up-second/70986/4 "2017-02-07T13:06:33Z")

</div>

This topic was automatically closed 28 days after the last reply. New replies are no longer allowed.
