# Is it able to get rank (order number) of \_score in Elasticsearch script score?

**URL:** <https://discuss.elastic.co/t/is-it-able-to-get-rank-order-number-of-score-in-elasticsearch-script-score/244527>\
**Category:** Elasticsearch\
**Created:** [August 11, 2020, 9:51am UTC](https://discuss.elastic.co/t/is-it-able-to-get-rank-order-number-of-score-in-elasticsearch-script-score/244527 "2020-08-11T09:51:44Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![taichi](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/taichi/32/46431_2.png) [@taichi](https://discuss.elastic.co/u/taichi)\
**Post date:** [August 11, 2020, 9:51am UTC](https://discuss.elastic.co/t/is-it-able-to-get-rank-order-number-of-score-in-elasticsearch-script-score/244527/1 "2020-08-11T09:51:44Z")

</div>

I would like to use \_score in script score, calculating its rank in entire hits.

For example, if there are these 3 hit documents;

```
{ "_id": 1, "_score": 0.7 }
{ "_id": 2, "_score": 0.5 }
{ "_id": 3, "_score": 1.0 }

```

I would like to rank of score as `2, 3, 1` for each documents and use the rank in script score.  
It it able to do such thing?

---

<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:** [September 8, 2020, 9:51am UTC](https://discuss.elastic.co/t/is-it-able-to-get-rank-order-number-of-score-in-elasticsearch-script-score/244527/2 "2020-09-08T09:51:51Z")

</div>

This topic was automatically closed 28 days after the last reply. New replies are no longer allowed.
