# Not getting score

**URL:** <https://discuss.elastic.co/t/not-getting-score/3850>\
**Category:** Elasticsearch\
**Created:** [January 31, 2011, 11:45am UTC](https://discuss.elastic.co/t/not-getting-score/3850 "2011-01-31T11:45:08Z")\
**Posts on this page:** 7\
**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:** [January 31, 2011, 11:45am UTC](https://discuss.elastic.co/t/not-getting-score/3850/1 "2011-01-31T11:45:08Z")

</div>

Hi,

```
   I am searching query with sort field means, i am getting the

```

result with max score as null. If i didn't specify sort field means, i  
am getting max score value....

I have mentioned the queries here...

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

curl -XGET '[http://localhost:9200/dbtest/data/\_search](http://localhost:9200/dbtest/data/_search)' -d  
' {"query" : { "bool" : { "should" : [{ "prefix" : { "field1":  
"print" } } ] } }, "from" : 0, "size" : 20, "explain"  
: false,"fields":["field1","field2"] }'

Currently i am using ES version 0.14.3...........

---

<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:** [January 31, 2011, 2:54pm UTC](https://discuss.elastic.co/t/not-getting-score/3850/2 "2011-01-31T14:54:27Z")

</div>

You need to add the score as another sorting field, and then you will get the score back.  
On Monday, January 31, 2011 at 1:45 PM, Arulkumar wrote:

> Hi,
> 
> I am searching query with sort field means, i am getting the  
> result with max score as null. If i didn't specify sort field means, i  
> am getting max score value....
> 
> I have mentioned the queries here...
> 
> curl -XGET '[http://localhost:9200/dbtest/data/\_search](http://localhost:9200/dbtest/data/_search)' -d  
> ' { "sort" : [ {"\_score" : {"reverse" :false } }  
> ] ,"query" : { "bool" : { "should" : [{ "prefix" : { "field1":  
> "print" } } ] } }, "from" : 0, "size" : 20, "explain"  
> : false,"fields":["field1","field2"] }'
> 
> curl -XGET '[http://localhost:9200/dbtest/data/\_search](http://localhost:9200/dbtest/data/_search)' -d  
> ' {"query" : { "bool" : { "should" : [{ "prefix" : { "field1":  
> "print" } } ] } }, "from" : 0, "size" : 20, "explain"  
> : false,"fields":["field1","field2"] }'
> 
> Currently i am using ES version 0.14.3...........

---

<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 1, 2011, 4:29am UTC](https://discuss.elastic.co/t/not-getting-score/3850/3 "2011-02-01T04:29:40Z")

</div>

I am getting score for both queries, but not getting  
"max\_score" .......?

On Jan 31, 7:54 pm, Shay Banon [shay.ba...@elasticsearch.com](mailto:shay.ba...@elasticsearch.com) wrote:

> You need to add the score as another sorting field, and then you will get the score back.
> 
> On Monday, January 31, 2011 at 1:45 PM, Arulkumar wrote:
> 
> > Hi,
> 
> > I am searching query with sort field means, i am getting the  
> > result with max score as null. If i didn't specify sort field means, i  
> > am getting max score value....
> 
> > I have mentioned the queries here...
> 
> > curl -XGET '[http://localhost:9200/dbtest/data/\_search'-d](http://localhost:9200/dbtest/data/_search'-d)  
> > ' { "sort" : [ {"\_score" : {"reverse" :false } }  
> > ] ,"query" : { "bool" : { "should" : [{ "prefix" : { "field1":  
> > "print" } } ] } }, "from" : 0, "size" : 20, "explain"  
> > : false,"fields":["field1","field2"] }'
> 
> > curl -XGET '[http://localhost:9200/dbtest/data/\_search'-d](http://localhost:9200/dbtest/data/_search'-d)  
> > ' {"query" : { "bool" : { "should" : [{ "prefix" : { "field1":  
> > "print" } } ] } }, "from" : 0, "size" : 20, "explain"  
> > : false,"fields":["field1","field2"] }'
> 
> > Currently i am using ES version 0.14.3...........

---

<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 1, 2011, 9:49am UTC](https://discuss.elastic.co/t/not-getting-score/3850/4 "2011-02-01T09:49:01Z")

</div>

Yea, in this case, max\_score will not be returned. This is done since it incurs a cost when just wanting to sort on other fields, but might be enabled, I need to check... .  
On Tuesday, February 1, 2011 at 6:29 AM, Arulkumar wrote:

> I am getting score for both queries, but not getting  
> "max\_score" .......?
> 
> On Jan 31, 7:54 pm, Shay Banon [shay.ba...@elasticsearch.com](mailto:shay.ba...@elasticsearch.com) wrote:
> 
> > You need to add the score as another sorting field, and then you will get the score back.
> > 
> > On Monday, January 31, 2011 at 1:45 PM, Arulkumar wrote:
> > 
> > > Hi,
> > 
> > > I am searching query with sort field means, i am getting the  
> > > result with max score as null. If i didn't specify sort field means, i  
> > > am getting max score value....
> > 
> > > I have mentioned the queries here...
> > 
> > > curl -XGET '[http://localhost:9200/dbtest/data/\_search'-d](http://localhost:9200/dbtest/data/_search'-d)  
> > > ' { "sort" : [ {"\_score" : {"reverse" :false } }  
> > > ] ,"query" : { "bool" : { "should" : [{ "prefix" : { "field1":  
> > > "print" } } ] } }, "from" : 0, "size" : 20, "explain"  
> > > : false,"fields":["field1","field2"] }'
> > 
> > > curl -XGET '[http://localhost:9200/dbtest/data/\_search'-d](http://localhost:9200/dbtest/data/_search'-d)  
> > > ' {"query" : { "bool" : { "should" : [{ "prefix" : { "field1":  
> > > "print" } } ] } }, "from" : 0, "size" : 20, "explain"  
> > > : false,"fields":["field1","field2"] }'
> > 
> > > Currently i am using ES version 0.14.3...........

---

<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 1, 2011, 10:41am UTC](https://discuss.elastic.co/t/not-getting-score/3850/5 "2011-02-01T10:41:50Z")

</div>

Ok, was not too difficult to enable: [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 Tuesday, February 1, 2011 at 11:49 AM, Shay Banon wrote:

> Yea, in this case, max\_score will not be returned. This is done since it incurs a cost when just wanting to sort on other fields, but might be enabled, I need to check... .  
> On Tuesday, February 1, 2011 at 6:29 AM, Arulkumar wrote:
> 
> > I am getting score for both queries, but not getting  
> > "max\_score" .......?
> > 
> > On Jan 31, 7:54 pm, Shay Banon [shay.ba...@elasticsearch.com](mailto:shay.ba...@elasticsearch.com) wrote:
> > 
> > > You need to add the score as another sorting field, and then you will get the score back.
> > > 
> > > On Monday, January 31, 2011 at 1:45 PM, Arulkumar wrote:
> > > 
> > > > Hi,
> > > 
> > > > I am searching query with sort field means, i am getting the  
> > > > result with max score as null. If i didn't specify sort field means, i  
> > > > am getting max score value....
> > > 
> > > > I have mentioned the queries here...
> > > 
> > > > curl -XGET '[http://localhost:9200/dbtest/data/\_search'-d](http://localhost:9200/dbtest/data/_search'-d)  
> > > > ' { "sort" : [ {"\_score" : {"reverse" :false } }  
> > > > ] ,"query" : { "bool" : { "should" : [{ "prefix" : { "field1":  
> > > > "print" } } ] } }, "from" : 0, "size" : 20, "explain"  
> > > > : false,"fields":["field1","field2"] }'
> > > 
> > > > curl -XGET '[http://localhost:9200/dbtest/data/\_search'-d](http://localhost:9200/dbtest/data/_search'-d)  
> > > > ' {"query" : { "bool" : { "should" : [{ "prefix" : { "field1":  
> > > > "print" } } ] } }, "from" : 0, "size" : 20, "explain"  
> > > > : false,"fields":["field1","field2"] }'
> > > 
> > > > Currently i am using ES version 0.14.3...........

---

<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 1, 2011, 12:30pm UTC](https://discuss.elastic.co/t/not-getting-score/3850/6 "2011-02-01T12:30:38Z")

</div>

Ok thank you..

On Feb 1, 3:41 pm, Shay Banon [shay.ba...@elasticsearch.com](mailto:shay.ba...@elasticsearch.com) wrote:

> Ok, was not too difficult to enable:[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 Tuesday, February 1, 2011 at 11:49 AM, Shay Banon wrote:
> 
> > Yea, in this case, max\_score will not be returned. This is done since it incurs a cost when just wanting to sort on other fields, but might be enabled, I need to check... .  
> > On Tuesday, February 1, 2011 at 6:29 AM, Arulkumar wrote:
> > 
> > > I am getting score for both queries, but not getting  
> > > "max\_score" .......?
> 
> > > On Jan 31, 7:54 pm, Shay Banon [shay.ba...@elasticsearch.com](mailto:shay.ba...@elasticsearch.com) wrote:
> > > 
> > > > You need to add the score as another sorting field, and then you will get the score back.
> 
> > > > On Monday, January 31, 2011 at 1:45 PM, Arulkumar wrote:
> > > > 
> > > > > Hi,
> 
> > > > > I am searching query with sort field means, i am getting the  
> > > > > result with max score as null. If i didn't specify sort field means, i  
> > > > > am getting max score value....
> 
> > > > > I have mentioned the queries here...
> 
> > > > > curl -XGET '[http://localhost:9200/dbtest/data/\_search'-d](http://localhost:9200/dbtest/data/_search'-d)  
> > > > > ' { "sort" : [ {"\_score" : {"reverse" :false } }  
> > > > > ] ,"query" : { "bool" : { "should" : [{ "prefix" : { "field1":  
> > > > > "print" } } ] } }, "from" : 0, "size" : 20, "explain"  
> > > > > : false,"fields":["field1","field2"] }'
> 
> > > > > curl -XGET '[http://localhost:9200/dbtest/data/\_search'-d](http://localhost:9200/dbtest/data/_search'-d)  
> > > > > ' {"query" : { "bool" : { "should" : [{ "prefix" : { "field1":  
> > > > > "print" } } ] } }, "from" : 0, "size" : 20, "explain"  
> > > > > : false,"fields":["field1","field2"] }'
> 
> > > > > Currently i am using ES version 0.14.3...........

---

<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/not-getting-score/3850/7 "2017-07-06T04:12:59Z")

</div>


