# Just Pushed: Using score in scripts (facets)

**URL:** <https://discuss.elastic.co/t/just-pushed-using-score-in-scripts-facets/3856>\
**Category:** Elasticsearch\
**Created:** [February 1, 2011, 11:44am UTC](https://discuss.elastic.co/t/just-pushed-using-score-in-scripts-facets/3856 "2011-02-01T11:44:01Z")\
**Posts on this page:** 4\
**Page:** 1

<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, 11:44am UTC](https://discuss.elastic.co/t/just-pushed-using-score-in-scripts-facets/3856/1 "2011-02-01T11:44:01Z")

</div>

You can now get the score and use it in scripts that different facets can accept: [https://github.com/elasticsearch/elasticsearch/issues/issue/663](https://github.com/elasticsearch/elasticsearch/issues/issue/663).

-shay.banon

---

<div class="post-metadata">

**Author:** ![Karussell1](https://avatars.discourse-cdn.com/v4/letter/k/50afbb/32.png) [@Karussell1](https://discuss.elastic.co/u/Karussell1)\
**Post date:** [February 4, 2011, 11:35pm UTC](https://discuss.elastic.co/t/just-pushed-using-score-in-scripts-facets/3856/2 "2011-02-04T23:35:57Z")

</div>

Is this related to:

> <https://github.com/elastic/elasticsearch/issues/631>
>
> Would it be possible to sort facets against the sumOf(score\_i) or even sumOf(sco…re\_i\*doc\_i\['someField'\]) ?
> 
> This would be really handy if you have several facets and want only show the most relevant ones. (e.g. trending keywords/urls at jetwick.com)
> 
> See also an open issue for Solr:
> 
> https://issues.apache.org/jira/browse/SOLR-385

I mean, can I now sort against doc.score?

On 1 Feb., 12:44, Shay Banon [shay.ba...@elasticsearch.com](mailto:shay.ba...@elasticsearch.com) wrote:

> You can now get the score and use it in scripts that different facets can accept:[Search Scripts: Allow to access score in facet related scripts using `doc.score` · Issue #663 · elastic/elasticsearch · GitHub](https://github.com/elasticsearch/elasticsearch/issues/issue/663).
> 
> -shay.banon

---

<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 7, 2011, 6:09pm UTC](https://discuss.elastic.co/t/just-pushed-using-score-in-scripts-facets/3856/3 "2011-02-07T18:09:30Z")

</div>

Its a start. You can now use it in scripts, which means its available to all facets to be easily consumed. Now, the different facets need to add it as a sortable option is applicable.  
On Saturday, February 5, 2011 at 1:35 AM, Karussell wrote:

> Is this related to:
> 
> [Sort Facets based on document score (or arbitrary script) · Issue #631 · elastic/elasticsearch · GitHub](https://github.com/elasticsearch/elasticsearch/issues/issue/631)
> 
> I mean, can I now sort against doc.score?
> 
> On 1 Feb., 12:44, Shay Banon [shay.ba...@elasticsearch.com](mailto:shay.ba...@elasticsearch.com) wrote:
> 
> > You can now get the score and use it in scripts that different facets can accept:[Search Scripts: Allow to access score in facet related scripts using `doc.score` · Issue #663 · elastic/elasticsearch · GitHub](https://github.com/elasticsearch/elasticsearch/issues/issue/663).
> > 
> > -shay.banon

---

<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/just-pushed-using-score-in-scripts-facets/3856/4 "2017-07-06T04:12:29Z")

</div>


