Max_score not working in Version 15-snapshot

In 15.0 Snapshot versions, I am getting max_score value, only for
score field. If I use any other field means, am getting max_score as
null and in condition { "reverse":true} also getting null.

I here explained the queries what I was use.

  1. Search Query:

curl -XGET 'http://localhost:9200/dbtest/data/_search' -d' { "sort" :
[ {"_score" : {"reverse" :false } } ] ,"query" : { "bool" :
{ "should" : [{ "term" : { "field1":"123" } } ] } }, "from" : 0,
"size" : 20, "explain" : false,"fields":["field1","field2"] }'

Search Result:

{"took":0,"_shards":{"total":5,"successful":5,"failed":0},"hits":
{"total":1,"max_score":7.593729,"hits":
[{"_index":"dbtest","_type":"data","_id":"123","_score":
7.593729,"fields":{"field1":"123","field2":"test"}}]}}

  1. Search Query:

curl -XGET 'http://localhost:9200/dbtest/data/_search' -d' { "sort" :
[ {"field2":{"reverse":false}} ] ,"query" : { "bool" : { "should" :
[{ "term" : { "field1":"123" } } ] } }, "from" : 0, "size" : 20,
"explain" : false,"fields":["field1","field2"] }'

Search Result:

{"took":0,"_shards":{"total":5,"successful":5,"failed":0},"hits":
{"total":1,"max_score":null,"hits":
[{"_index":"dbtest","_type":"data","_id":"123","_score":null,"fields":
{"_fileid":"123","m_begdoc":"test"},"sort":["test"]}]}}

Didn't we had this discussion a few days ago? See this: Search: When sorting, allow to pass `track_scores` and set it to `true` to get scores/max_score back · Issue #662 · elastic/elasticsearch · GitHub.
On Thursday, February 3, 2011 at 11:23 AM, Arulkumar wrote:

In 15.0 Snapshot versions, I am getting max_score value, only for
score field. If I use any other field means, am getting max_score as
null and in condition { "reverse":true} also getting null.

I here explained the queries what I was use.

  1. Search Query:

curl -XGET 'http://localhost:9200/dbtest/data/_search' -d' { "sort" :
[ {"_score" : {"reverse" :false } } ] ,"query" : { "bool" :
{ "should" : [{ "term" : { "field1":"123" } } ] } }, "from" : 0,
"size" : 20, "explain" : false,"fields":["field1","field2"] }'

Search Result:

{"took":0,"_shards":{"total":5,"successful":5,"failed":0},"hits":
{"total":1,"max_score":7.593729,"hits":
[{"_index":"dbtest","_type":"data","_id":"123","_score":
7.593729,"fields":{"field1":"123","field2":"test"}}]}}

  1. Search Query:

curl -XGET 'http://localhost:9200/dbtest/data/_search' -d' { "sort" :
[ {"field2":{"reverse":false}} ] ,"query" : { "bool" : { "should" :
[{ "term" : { "field1":"123" } } ] } }, "from" : 0, "size" : 20,
"explain" : false,"fields":["field1","field2"] }'

Search Result:

{"took":0,"_shards":{"total":5,"successful":5,"failed":0},"hits":
{"total":1,"max_score":null,"hits":
[{"_index":"dbtest","_type":"data","_id":"123","_score":null,"fields":
{"_fileid":"123","m_begdoc":"test"},"sort":["test"]}]}}

Hi Shay,
We tried enabling track_scores also. But I am getting null for max score.

Query used for searching is

curl -XGET 'http://localhost:9200/dbtest/data/_search' -d' { "sort" :[{"_uniquefield" : {"reverse" :false,"track_scores":"true" } },{"_score" : {"reverse" :false,"track_scores":"true" } } ] ,"query" : { "bool" :{ "should" : [{ "term" : { "subject":"hello" } } ] } }, "from" : 0,"size" : 0, "explain" : false}'

{"took":0,"_shards":{"total":2,"successful":2,"failed":0},"hits":{"total":4,"max_score":null,"hits":[]}}

Let me know if I am missing anything?

Place the track scores on the same level as "sort" element.
On Thursday, February 3, 2011 at 11:34 AM, srrIN wrote:

Hi Shay,
We tried enabling track_scores also. But I am getting null for max score.

Query used for searching is

curl -XGET 'http://localhost:9200/dbtest/data/_search' -d' { "sort"
:[{"_uniquefield" : {"reverse" :false,"track_scores":"true" } },{"_score" :
{"reverse" :false,"track_scores":"true" } } ] ,"query" : { "bool" :{
"should" : [{ "term" : { "subject":"hello" } } ] } }, "from" : 0,"size" :
0, "explain" : false}'

{"took":0,"_shards":{"total":2,"successful":2,"failed":0},"hits":{"total":4,"max_score":null,"hits":}}

Let me know if I am missing anything?

View this message in context: http://elasticsearch-users.115913.n3.nabble.com/max-score-not-working-in-Version-15-snapshot-tp2411859p2411932.html
Sent from the Elasticsearch Users mailing list archive at Nabble.com.

Hi Shay,
I tried placing the track scores in the same level

curl -XGET 'http://localhost:9200/dbtest/data/_search' -d' {"track_scores":"true", "sort" :[{"_uniquefield" : {"reverse" :false } },{"_score" : {"reverse" :false} } ] ,"query" : { "bool" :{ "should" : [{ "term" : { "subject":"hello" } } ] } }, "from" : 0,"size" : 20, "explain" : false}'

and get the error as

Parse Failure [No parser for element [track_scores]]

It woks well for me, make sure you have a build of 0.15 that includes it. If it sill does not work for you, gist a curl recreation. Also track_scores set to true, not "true".
On Thursday, February 3, 2011 at 11:58 AM, srrIN wrote:

Hi Shay,
I tried placing the track scores in the same level

curl -XGET 'http://localhost:9200/dbtest/data/_search' -d'
{"track_scores":"true", "sort" :[{"_uniquefield" : {"reverse" :false }
},{"_score" : {"reverse" :false} } ] ,"query" : { "bool" :{ "should" : [{
"term" : { "subject":"hello" } } ] } }, "from" : 0,"size" : 20, "explain" :
false}'

and get the error as

Parse Failure [No parser for element [track_scores]]

View this message in context: http://elasticsearch-users.115913.n3.nabble.com/max-score-not-working-in-Version-15-snapshot-tp2411859p2412134.html
Sent from the Elasticsearch Users mailing list archive at Nabble.com.

Hi Shay,
I tried redeploying all binaries and the above search worked fine. Thanks for your timing.