Skip to content

Instantly share code, notes, and snippets.

@nickhoffman
Created February 6, 2012 02:27
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save nickhoffman/51059b4774ec9d33249c to your computer and use it in GitHub Desktop.
Save nickhoffman/51059b4774ec9d33249c to your computer and use it in GitHub Desktop.
Why does the "boost" not affect the score?
## 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'
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" }
} ]
}
}
{
"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