# Max\_score not working in Version 15-snapshot

**URL:** <https://discuss.elastic.co/t/max-score-not-working-in-version-15-snapshot/3870>\
**Category:** Elasticsearch\
**Created:** [February 3, 2011, 9:23am UTC](https://discuss.elastic.co/t/max-score-not-working-in-version-15-snapshot/3870 "2011-02-03T09:23:17Z")\
**Posts on this page:** 8\
**Page:** 1

<div class="post-metadata">

**Author:** ![Arulkumar](https://avatars.discourse-cdn.com/v4/letter/a/6de8d8/32.png) [@Arulkumar](https://discuss.elastic.co/u/Arulkumar)\
**Post date:** [February 3, 2011, 9:23am UTC](https://discuss.elastic.co/t/max-score-not-working-in-version-15-snapshot/3870/1 "2011-02-03T09:23:17Z")

</div>

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](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](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"]}]}}

---

<div class="post-metadata">

**Author:** ![kimchy](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/kimchy/32/44952_2.png) [@kimchy](https://discuss.elastic.co/u/kimchy)\
**Post date:** [February 3, 2011, 9:26am UTC](https://discuss.elastic.co/t/max-score-not-working-in-version-15-snapshot/3870/2 "2011-02-03T09:26:09Z")

</div>

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](https://github.com/elasticsearch/elasticsearch/issues/issue/662).  
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](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](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"]}]}}

---

<div class="post-metadata">

**Author:** ![srrin](https://avatars.discourse-cdn.com/v4/letter/s/85f322/32.png) [@srrin](https://discuss.elastic.co/u/srrin)\
**Post date:** [February 3, 2011, 9:34am UTC](https://discuss.elastic.co/t/max-score-not-working-in-version-15-snapshot/3870/3 "2011-02-03T09:34:16Z")

</div>

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](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?

---

<div class="post-metadata">

**Author:** ![kimchy](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/kimchy/32/44952_2.png) [@kimchy](https://discuss.elastic.co/u/kimchy)\
**Post date:** [February 3, 2011, 9:51am UTC](https://discuss.elastic.co/t/max-score-not-working-in-version-15-snapshot/3870/4 "2011-02-03T09:51:06Z")

</div>

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](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](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](http://Nabble.com).

---

<div class="post-metadata">

**Author:** ![srrin](https://avatars.discourse-cdn.com/v4/letter/s/85f322/32.png) [@srrin](https://discuss.elastic.co/u/srrin)\
**Post date:** [February 3, 2011, 9:58am UTC](https://discuss.elastic.co/t/max-score-not-working-in-version-15-snapshot/3870/5 "2011-02-03T09:58:24Z")

</div>

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

curl -XGET '[http://localhost:9200/dbtest/data/\_search](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]]

---

<div class="post-metadata">

**Author:** ![kimchy](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/kimchy/32/44952_2.png) [@kimchy](https://discuss.elastic.co/u/kimchy)\
**Post date:** [February 3, 2011, 10:02am UTC](https://discuss.elastic.co/t/max-score-not-working-in-version-15-snapshot/3870/6 "2011-02-03T10:02:05Z")

</div>

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](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](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](http://Nabble.com).

---

<div class="post-metadata">

**Author:** ![srrin](https://avatars.discourse-cdn.com/v4/letter/s/85f322/32.png) [@srrin](https://discuss.elastic.co/u/srrin)\
**Post date:** [February 3, 2011, 10:30am UTC](https://discuss.elastic.co/t/max-score-not-working-in-version-15-snapshot/3870/7 "2011-02-03T10:30:00Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![system](https://us1.discourse-cdn.com/elastic/original/3X/1/a/1ac57faf039f6b580b3f104ef42a2a89e41014de.png) [@system](https://discuss.elastic.co/u/system)\
**Post date:** [July 6, 2017, 4:12am UTC](https://discuss.elastic.co/t/max-score-not-working-in-version-15-snapshot/3870/8 "2017-07-06T04:12:45Z")

</div>


