# Access \_score from Sort script

**URL:** https://discuss.elastic.co/t/access--score-from-sort-script/18940
**Category:** Elasticsearch
**Created:** [July 29, 2014, 2:23am UTC](https://discuss.elastic.co/t/access--score-from-sort-script/18940 "2014-07-29T02:23:41Z")
**Posts on this page:** 4
**Page:** 1

<div class="post-metadata">

### Author: ![Maxime\_Nay](https://avatars.discourse-cdn.com/v4/letter/m/edb3f5/32.png) [@Maxime\_Nay](https://discuss.elastic.co/u/Maxime_Nay)
#### Post date: [July 29, 2014, 2:23am UTC](https://discuss.elastic.co/t/access--score-from-sort-script/18940/1 "2014-07-29T02:23:41Z")

</div>

Hi,

I am trying to sort using a script sort.  
My script would look like: \_score \* doc['someField'].value  
When I submit the query I am getting: unresolvable property or identifier:  
\_score

Is it not possible to use the score in a script sort?

Thanks!

--  
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](mailto:elasticsearch+unsubscribe@googlegroups.com).  
To view this discussion on the web visit [https://groups.google.com/d/msgid/elasticsearch/89f52074-c2c5-4e35-a779-0e0aeb567931%40googlegroups.com](https://groups.google.com/d/msgid/elasticsearch/89f52074-c2c5-4e35-a779-0e0aeb567931%40googlegroups.com).  
For more options, visit [https://groups.google.com/d/optout](https://groups.google.com/d/optout).

---

<div class="post-metadata">

### Author: ![vineeth\_mohan\_2](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/vineeth_mohan_2/32/747_2.png) [@vineeth\_mohan\_2](https://discuss.elastic.co/u/vineeth_mohan_2)
#### Post date: [July 29, 2014, 2:52am UTC](https://discuss.elastic.co/t/access--score-from-sort-script/18940/2 "2014-07-29T02:52:48Z")

</div>

Hi ,

Its doable from here -

> **[Elasticsearch Platform — Find real-time answers at scale](https://www.elastic.co)**
>
> Power insights and outcomes with the Elasticsearch Platform and AI. See into your data and find answers that matter with enterprise solutions designed to help you build, observe, and protect. Try Elasticsearch free today.

Thanks  
Vineeth

On Tue, Jul 29, 2014 at 7:53 AM, Maxime Nay [maximenay@gmail.com](mailto:maximenay@gmail.com) wrote:

> Hi,
> 
> I am trying to sort using a script sort.  
> My script would look like: \_score \* doc['someField'].value  
> When I submit the query I am getting: unresolvable property or identifier:  
> \_score
> 
> Is it not possible to use the score in a script sort?
> 
> Thanks!
> 
> --  
> 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](mailto:elasticsearch+unsubscribe@googlegroups.com).  
> To view this discussion on the web visit  
> [https://groups.google.com/d/msgid/elasticsearch/89f52074-c2c5-4e35-a779-0e0aeb567931%40googlegroups.com](https://groups.google.com/d/msgid/elasticsearch/89f52074-c2c5-4e35-a779-0e0aeb567931%40googlegroups.com)  
> [https://groups.google.com/d/msgid/elasticsearch/89f52074-c2c5-4e35-a779-0e0aeb567931%40googlegroups.com?utm\_medium=email&utm\_source=footer](https://groups.google.com/d/msgid/elasticsearch/89f52074-c2c5-4e35-a779-0e0aeb567931%40googlegroups.com?utm_medium=email&utm_source=footer)  
> .  
> For more options, visit [https://groups.google.com/d/optout](https://groups.google.com/d/optout).

--  
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](mailto:elasticsearch+unsubscribe@googlegroups.com).  
To view this discussion on the web visit [https://groups.google.com/d/msgid/elasticsearch/CAGdPd5kqbZL4yLgZDXRXo4D7\_g0m%2BkV%2BXepZGrE6FrLdBJav8Q%40mail.gmail.com](https://groups.google.com/d/msgid/elasticsearch/CAGdPd5kqbZL4yLgZDXRXo4D7_g0m%2BkV%2BXepZGrE6FrLdBJav8Q%40mail.gmail.com).  
For more options, visit [https://groups.google.com/d/optout](https://groups.google.com/d/optout).

---

<div class="post-metadata">

### Author: ![Maxime\_Nay](https://avatars.discourse-cdn.com/v4/letter/m/edb3f5/32.png) [@Maxime\_Nay](https://discuss.elastic.co/u/Maxime_Nay)
#### Post date: [July 29, 2014, 2:58am UTC](https://discuss.elastic.co/t/access--score-from-sort-script/18940/3 "2014-07-29T02:58:31Z")

</div>

Hi Vineeth,

I want to use the score for some other purpose. (retrieve the number of  
children with a has\_child query)  
Hence I can't modify it's calculation in script score.

On Monday, July 28, 2014 7:53:01 PM UTC-7, vineeth mohan wrote:

> Hi ,
> 
> Its doable from here -  
> [Elasticsearch Platform — Find real-time answers at scale | Elastic](http://www.elasticsearch.org/guide/en/elasticsearch/reference/current/query-dsl-function-score-query.html#_script_score)
> 
> Thanks  
> Vineeth
> 
> On Tue, Jul 29, 2014 at 7:53 AM, Maxime Nay \<[maxi...@gmail.com](mailto:maxi...@gmail.com)  
> \<javascript:\>\> wrote:
> 
> > Hi,
> > 
> > I am trying to sort using a script sort.  
> > My script would look like: \_score \* doc['someField'].value  
> > When I submit the query I am getting: unresolvable property or  
> > identifier: \_score
> > 
> > Is it not possible to use the score in a script sort?
> > 
> > Thanks!
> > 
> > --  
> > 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 [elasticsearc...@googlegroups.com](mailto:elasticsearc...@googlegroups.com) \<javascript:\>.  
> > To view this discussion on the web visit  
> > [https://groups.google.com/d/msgid/elasticsearch/89f52074-c2c5-4e35-a779-0e0aeb567931%40googlegroups.com](https://groups.google.com/d/msgid/elasticsearch/89f52074-c2c5-4e35-a779-0e0aeb567931%40googlegroups.com)  
> > [https://groups.google.com/d/msgid/elasticsearch/89f52074-c2c5-4e35-a779-0e0aeb567931%40googlegroups.com?utm\_medium=email&utm\_source=footer](https://groups.google.com/d/msgid/elasticsearch/89f52074-c2c5-4e35-a779-0e0aeb567931%40googlegroups.com?utm_medium=email&utm_source=footer)  
> > .  
> > For more options, visit [https://groups.google.com/d/optout](https://groups.google.com/d/optout).

--  
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](mailto:elasticsearch+unsubscribe@googlegroups.com).  
To view this discussion on the web visit [https://groups.google.com/d/msgid/elasticsearch/f829c726-cf0b-40d5-8d30-96d3b4c3b008%40googlegroups.com](https://groups.google.com/d/msgid/elasticsearch/f829c726-cf0b-40d5-8d30-96d3b4c3b008%40googlegroups.com).  
For more options, visit [https://groups.google.com/d/optout](https://groups.google.com/d/optout).

---

<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, 1:12am UTC](https://discuss.elastic.co/t/access--score-from-sort-script/18940/4 "2017-07-06T01:12:40Z")

</div>


