Why is an exact match coming up second?


(Aaron Bauman) #1

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\valueis 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": []
}
]
}
]
}
]
}
}


(Russ Cam) #2

what version of Elasticsearch are you using?


(Aaron Bauman) #3

Version 5.1.1


(system) #4

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