Hi guys,
for some reason, the order by name, _score is not working as I would expect.
I've prepared a simple example to explain what I mean.
There are 2 records: john doe and jane doe. if there is no email in the
index their score is the same, and the order is correct, jane goes before
john, but if john's record has email which contain doe (the search phrase),
john _score is higher and the order is wrong.
I've noticed that in the results the "sort" node is [ "doe", 0.6328839 ], [
"doe", 0.48819983 ] rather than [ "john doe", 0.6328839 ], [ "jane doe",
0.48819983 ]. if the order is name:desc the search is [ "jane", 0.6328839
], [ "john", 0.48819983 ]
This happen when I use query:{...}. If the query is missing the results get
the same weight and it is working as expected.
do I need to make special sort somehow in order to get the desired order,
or it's a bug?
Thanks in advance.
Here is the script how to see this behavior. I am using 0.90.5 if it does
matter (tested 0.90.8 with the same effect). BTW, if the name is without a
space e.g. johndoe, janedoe the order is correct.
curl -XDELETE 'http://localhost:9200/test_search'
curl -XPUT 'http://localhost:9200/test_search/' -d '
{
"mappings" : {
"record" : {
"properties" : {
"object" : {
"type" : "string"
},
"id" : {
"type" : "integer"
},
"name" : {
"type" : "string",
"boost" : 6
},
"email" : {
"type" : "string",
"boost" : 5
}
}
}
}
}
'
curl -XPUT 'http://localhost:9200/test_search/record/1' -d '{
"object" : "User",
"id" : 1,
"name" : "john doe",
"email" : "doe@doe.com"
}'
curl -XPUT 'http://localhost:9200/test_search/record/2' -d '{
"object" : "User",
"id" : 2,
"name" : "jane doe",
"email" : "j@d.com"
}'
curl -XGET 'http://localhost:9200/test_search/_search?pretty=true' -d
'{"query":{"filtered":{"query":{"queryString":{"query":"doe"}}}},"sort":[{"name":"asc"},"_score"]}'
--
You received this message because you are subscribed to the Google Groups "elasticsearch" group.
To unsubscribe from this group and stop receiving emails from it, send an email to elasticsearch+unsubscribe@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/elasticsearch/f8fbba45-186a-42b2-86be-970ef65e60a5%40googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.