# ElasticSearch 7.7.1 plugin for custom score

**URL:** <https://discuss.elastic.co/t/elasticsearch-7-7-1-plugin-for-custom-score/245001>\
**Category:** Elasticsearch\
**Created:** [August 14, 2020, 11:32am UTC](https://discuss.elastic.co/t/elasticsearch-7-7-1-plugin-for-custom-score/245001 "2020-08-14T11:32:34Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![dimminbox](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/dimminbox/32/73883_2.png) [@dimminbox](https://discuss.elastic.co/u/dimminbox)\
**Post date:** [August 14, 2020, 11:32am UTC](https://discuss.elastic.co/t/elasticsearch-7-7-1-plugin-for-custom-score/245001/1 "2020-08-14T11:32:34Z")

</div>

Hi,

Now i'm using ElasticSearch 5.3 with groovy script for calculationg of score.  
This script use \_`doc[field].size()` for get count of tokens for field by document.  
This logic i'm trying to apply in custom plugin for ElasticSearch 7.7.1.

i'm using [https://www.elastic.co/guide/en/elasticsearch/reference/master/modules-scripting-engine.html](https://www.elastic.co/guide/en/elasticsearch/reference/master/modules-scripting-engine.html) for example

But i'cant know how can get a tokens for field (with applying a default tokenizer for field) by document.  
Also i dont' know how to get field value for document from ElastSearch:

`context.reader().document(docId)`  
return Apache Lucene Document with two fields: \_id and \_source.

---

<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 11, 2020, 11:32am UTC](https://discuss.elastic.co/t/elasticsearch-7-7-1-plugin-for-custom-score/245001/2 "2020-09-11T11:32:36Z")

</div>

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