Question on scoring

Dear all,

I have a testing on elastic search and I have a problem. I have a simple settings my index "addresstest4" like this:

PUT addresstest4
{
"mappings" : {
"external" : {
"properties": {
"address": {
"type": "text",
"analyzer" : "whitespace"
}
}
}
}
}

And then I have put bulk data to addresstest4/external like this:

{"index":{"_id":"1"}}
{"address" : "ab cde cfg lmn"}
{"index":{"_id":"2"}}
{"address" : "ab hig don"}
{"index":{"_id":"3"}}
{"address" : "ab cde jkg qrn"}
{"index":{"_id":"4"}}
{"address" : "ab cde jkg stun"}
{"index":{"_id":"5"}}
{"address" : "ab hig pvn"}
{"index":{"_id":"6"}}
{"address" : "ab cde cfg pxn"}
{"index":{"_id":"7"}}
{"address" : "ab cde cfg yzn"}

And then I try to search the "ab hig pvn" result using "hig pvn", therefore I perform search like this:

GET /addresstest4/_search
{
"query": {
"match" : { "address" : {
"query" :"hig pvn",
"analyzer": "whitespace"
}
}},
"highlight" : {
"fields" : {
"address" : {}
}
}
}

However I got the result like this:

{
"took": 5,
"timed_out": false,
"_shards": {
"total": 5,
"successful": 5,
"failed": 0
},
"hits": {
"total": 2,
"max_score": 0.94566005,
"hits": [
{
"_index": "addresstest4",
"_type": "external",
"_id": "2",
"_score": 0.94566005,
"_source": {
"address": "ab hig don"
},
"highlight": {
"address": [
"ab hig don"
]
}
},
{
"_index": "addresstest4",
"_type": "external",
"_id": "5",
"_score": 0.5063205,
"_source": {
"address": "ab hig pvn"
},
"highlight": {
"address": [
"ab hig pvn"
]
}
}
]
}
}

My question is: Why "ab hig don" will have a higher score than "ab hig pvn" when I search using "hig pvn"?

Regards,
Bob

My first guess is that is has to with search_type.

1 Like

Does it take longer to compute using dfs_query_then_fetch. ? And it seems like it would be more accurate?

I have tried "dfs_query_then_fetch" and it works, thanks a lot, although I don't know the detail behind :joy:

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