-
-
Save nickhoffman/51059b4774ec9d33249c to your computer and use it in GitHub Desktop.
Why does the "boost" not affect the score?
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
## In the 2 queries below, the documents have the same score, despite the 2nd query having a boost. | |
curl -X DELETE 'localhost:9200/test?pretty=1' | |
curl -X POST 'localhost:9200/test/foo?pretty=1' -d '{ name: "Nick Hoffman" }' | |
curl -X POST 'localhost:9200/test/foo?pretty=1' -d '{ name: "John Smith" }' | |
curl -X POST 'localhost:9200/test/foo?pretty=1' -d '{ name: "Nick Other" }' | |
curl -X POST 'localhost:9200/test/_refresh?pretty=1' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
curl 'localhost:9200/test/foo/_search?pretty=1&explain=0' -d '{ | |
"query":{ | |
"dis_max":{ | |
"queries":[ | |
{ "text": { "name": { query: "Nick" } } } | |
] | |
} | |
} | |
}' | |
{ | |
"took" : 2, | |
"timed_out" : false, | |
"_shards" : { | |
"total" : 5, | |
"successful" : 5, | |
"failed" : 0 | |
}, | |
"hits" : { | |
"total" : 2, | |
"max_score" : 0.19178301, | |
"hits" : [ { | |
"_index" : "test", | |
"_type" : "foo", | |
"_id" : "-EZKwqUsRzqy4uh1AeVGnA", | |
"_score" : 0.19178301, "_source" : { name: "Nick Other" } | |
}, { | |
"_index" : "test", | |
"_type" : "foo", | |
"_id" : "AEq9G1THQG6EAADy7ewFAQ", | |
"_score" : 0.19178301, "_source" : { name: "Nick Hoffman" } | |
} ] | |
} | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{ | |
"took" : 2, | |
"timed_out" : false, | |
"_shards" : { | |
"total" : 5, | |
"successful" : 5, | |
"failed" : 0 | |
}, | |
"hits" : { | |
"total" : 2, | |
"max_score" : 0.19178301, | |
"hits" : [ { | |
"_index" : "test", | |
"_type" : "foo", | |
"_id" : "-EZKwqUsRzqy4uh1AeVGnA", | |
"_score" : 0.19178301, "_source" : { name: "Nick Other" } | |
}, { | |
"_index" : "test", | |
"_type" : "foo", | |
"_id" : "AEq9G1THQG6EAADy7ewFAQ", | |
"_score" : 0.19178301, "_source" : { name: "Nick Hoffman" } | |
} ] | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment