# Script-expert-scoring question

**URL:** <https://discuss.elastic.co/t/script-expert-scoring-question/155385>\
**Category:** Elasticsearch\
**Created:** [November 5, 2018, 11:05am UTC](https://discuss.elastic.co/t/script-expert-scoring-question/155385 "2018-11-05T11:05:25Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![CristianoFerreira](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/cristianoferreira/32/47529_2.png) [@CristianoFerreira](https://discuss.elastic.co/u/CristianoFerreira)\
**Post date:** [November 5, 2018, 11:05am UTC](https://discuss.elastic.co/t/script-expert-scoring-question/155385/1 "2018-11-05T11:05:25Z")

</div>

Greetings,

I have a question regarding the [script-expert-scoring](https://github.com/elastic/elasticsearch/tree/master/plugins/examples/script-expert-scoring) plugin example.  
Is there a way to get the **total number of hits** in this part of the code:

```
@Override
        public ScoreScript newInstance(LeafReaderContext context)
                throws IOException {
            PostingsEnum postings = context.reader().postings( new Term(field, term));   

```

Thank you

---

<div class="post-metadata">

**Author:** ![spinscale](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/spinscale/32/25011_2.png) [@spinscale](https://discuss.elastic.co/u/spinscale)\
**Post date:** [November 6, 2018, 9:01am UTC](https://discuss.elastic.co/t/script-expert-scoring-question/155385/2 "2018-11-06T09:01:56Z")

</div>

Hey,

after a quick peek I could not see a way. Can you explain what you are after maybe?

Also, you might want to check out the [scripted similarity](https://www.elastic.co/guide/en/elasticsearch/reference/6.4/index-modules-similarity.html#scripted_similarity)

--Alex

---

<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:** [December 4, 2018, 9:02am UTC](https://discuss.elastic.co/t/script-expert-scoring-question/155385/3 "2018-12-04T09:02:09Z")

</div>

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