# Should the "script fields" feature have access to doc.\_score?

**URL:** <https://discuss.elastic.co/t/should-the-script-fields-feature-have-access-to-doc--score/10883>\
**Category:** Elasticsearch\
**Created:** [February 25, 2013, 4:21pm UTC](https://discuss.elastic.co/t/should-the-script-fields-feature-have-access-to-doc--score/10883 "2013-02-25T16:21:46Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![Roly\_Vicaria](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/roly_vicaria/32/506_2.png) [@Roly\_Vicaria](https://discuss.elastic.co/u/Roly_Vicaria)\
**Post date:** [February 25, 2013, 4:21pm UTC](https://discuss.elastic.co/t/should-the-script-fields-feature-have-access-to-doc--score/10883/1 "2013-02-25T16:21:46Z")

</div>

Hi,

I was trying to use the script fields feature to add a field based on the  
score from a custom\_score\_query and it's doesn't seem to be working. Does  
this sound like something that should be working?

So basically, something like this:

query  
custom\_score\_query

script\_fields  
someField  
script: something that uses doc.\_score/doc.score

Thanks.

Roly

--  
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).  
For more options, visit [https://groups.google.com/groups/opt\_out](https://groups.google.com/groups/opt_out).

---

<div class="post-metadata">

**Author:** ![Roly\_Vicaria](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/roly_vicaria/32/506_2.png) [@Roly\_Vicaria](https://discuss.elastic.co/u/Roly_Vicaria)\
**Post date:** [February 25, 2013, 6:16pm UTC](https://discuss.elastic.co/t/should-the-script-fields-feature-have-access-to-doc--score/10883/2 "2013-02-25T18:16:23Z")

</div>

I tried something like this:

{  
"query": {  
"custom\_score": {  
"query": {  
"match\_all": {}  
},  
"script": "\_score \* 3"  
}  
},  
"script\_fields": {  
"theRealScore": {  
"script": "doc.\_score / 3"  
}  
}  
}

On Monday, February 25, 2013 11:21:46 AM UTC-5, Roly Vicaria wrote:

> Hi,
> 
> I was trying to use the script fields feature to add a field based on the  
> score from a custom\_score\_query and it's doesn't seem to be working. Does  
> this sound like something that should be working?
> 
> So basically, something like this:
> 
> query  
> custom\_score\_query
> 
> script\_fields  
> someField  
> script: something that uses doc.\_score/doc.score
> 
> Thanks.
> 
> Roly

--  
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).  
For more options, visit [https://groups.google.com/groups/opt\_out](https://groups.google.com/groups/opt_out).

---

<div class="post-metadata">

**Author:** ![micherr](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/micherr/32/1908_2.png) [@micherr](https://discuss.elastic.co/u/micherr)\
**Post date:** [November 18, 2013, 10:29am UTC](https://discuss.elastic.co/t/should-the-script-fields-feature-have-access-to-doc--score/10883/3 "2013-11-18T10:29:12Z")

</div>

Hi!

Is there any updates on the subject? I`m facing a similar situation, when I need to get my complex score in 'script\_fields'.

---

<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, 2:06am UTC](https://discuss.elastic.co/t/should-the-script-fields-feature-have-access-to-doc--score/10883/4 "2017-07-06T02:06:28Z")

</div>


