# How can custom calculated scoring/boosting data be returned with the result set

**URL:** <https://discuss.elastic.co/t/how-can-custom-calculated-scoring-boosting-data-be-returned-with-the-result-set/10326>\
**Category:** Elasticsearch\
**Created:** [January 14, 2013, 7:26am UTC](https://discuss.elastic.co/t/how-can-custom-calculated-scoring-boosting-data-be-returned-with-the-result-set/10326 "2013-01-14T07:26:58Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![Mario](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/mario/32/2527_2.png) [@Mario](https://discuss.elastic.co/u/Mario)\
**Post date:** [January 14, 2013, 7:26am UTC](https://discuss.elastic.co/t/how-can-custom-calculated-scoring-boosting-data-be-returned-with-the-result-set/10326/1 "2013-01-14T07:26:58Z")

</div>

Is there some way to return any calculated data, which is used in scoring  
or boosting, as part of the result set? We need to return important  
calculated data used in scoring but we try to avoid doing the calculations  
twice since they are costly. As far as I can see from other threads, it  
seems script\_fields cannot be used in custom scoring or boosting of result  
items. Is there some way to workaround this by using it in another way or  
are there other means to get my calculations returned with the items  
without recomputing them?

--

---

<div class="post-metadata">

**Author:** ![dadoonet](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/dadoonet/32/137187_2.png) [@dadoonet](https://discuss.elastic.co/u/dadoonet)\
**Post date:** [January 14, 2013, 9:30am UTC](https://discuss.elastic.co/t/how-can-custom-calculated-scoring-boosting-data-be-returned-with-the-result-set/10326/2 "2013-01-14T09:30:08Z")

</div>

Have a look at explain feature: [Elasticsearch Platform — Find real-time answers at scale | Elastic](http://www.elasticsearch.org/guide/reference/api/search/explain.html)

--  
David 😉  
Twitter : @dadoonet / @elasticsearchfr / @scrutmydocs

Le 14 janv. 2013 à 08:26, Mario [mj@bioql.com](mailto:mj@bioql.com) a écrit :

> Is there some way to return any calculated data, which is used in scoring or boosting, as part of the result set? We need to return important calculated data used in scoring but we try to avoid doing the calculations twice since they are costly. As far as I can see from other threads, it seems script\_fields cannot be used in custom scoring or boosting of result items. Is there some way to workaround this by using it in another way or are there other means to get my calculations returned with the items without recomputing them?
> 
> --

--

---

<div class="post-metadata">

**Author:** ![Mario](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/mario/32/2527_2.png) [@Mario](https://discuss.elastic.co/u/Mario)\
**Post date:** [January 14, 2013, 10:11am UTC](https://discuss.elastic.co/t/how-can-custom-calculated-scoring-boosting-data-be-returned-with-the-result-set/10326/3 "2013-01-14T10:11:09Z")

</div>

I am not sure how this works with a custom script. The API documentation  
isn't very comprehensive in this regard. I forgot to mention that our  
scripts would be in Python and I guess this probably only works out of the  
box with mvel?

On Monday, January 14, 2013 10:30:08 AM UTC+1, David Pilato wrote:

> Have a look at explain feature:  
> [Elasticsearch Platform — Find real-time answers at scale | Elastic](http://www.elasticsearch.org/guide/reference/api/search/explain.html)
> 
> --  
> David 😉  
> Twitter : @dadoonet / @elasticsearchfr / @scrutmydocs
> 
> Le 14 janv. 2013 à 08:26, Mario \<[m...@bioql.com](mailto:m...@bioql.com) \<javascript:\>\> a écrit :
> 
> Is there some way to return any calculated data, which is used in scoring  
> or boosting, as part of the result set? We need to return important  
> calculated data used in scoring but we try to avoid doing the calculations  
> twice since they are costly. As far as I can see from other threads, it  
> seems script\_fields cannot be used in custom scoring or boosting of result  
> items. Is there some way to workaround this by using it in another way or  
> are there other means to get my calculations returned with the items  
> without recomputing them?
> 
> --

--

---

<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:56am UTC](https://discuss.elastic.co/t/how-can-custom-calculated-scoring-boosting-data-be-returned-with-the-result-set/10326/4 "2017-07-06T02:56:39Z")

</div>


