# Elasticsearch scripting engine

**URL:** <https://discuss.elastic.co/t/elasticsearch-scripting-engine/98424>\
**Category:** Elasticsearch\
**Created:** [August 25, 2017, 11:11pm UTC](https://discuss.elastic.co/t/elasticsearch-scripting-engine/98424 "2017-08-25T23:11:43Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![prasperl](https://avatars.discourse-cdn.com/v4/letter/p/df788c/32.png) [@prasperl](https://discuss.elastic.co/u/prasperl)\
**Post date:** [August 25, 2017, 11:11pm UTC](https://discuss.elastic.co/t/elasticsearch-scripting-engine/98424/1 "2017-08-25T23:11:43Z")

</div>

I am using elasticsearch 5.5 and I am trying to implement my own scoring algorithm to calculate the edit distance and come up with a custom score.

I found lot of good examples of native scripts to do this,but since native since are deperecated in 5.5 I need to do this in scrpting engine.Does anyone have good examples of such custom score implementation via scripting engine?

[https://www.elastic.co/guide/en/elasticsearch/reference/current/modules-scripting-engine.html](https://www.elastic.co/guide/en/elasticsearch/reference/current/modules-scripting-engine.html)

Native script example:

> **[ixxi-mobility/elasticsearch-editdistance-scoring](https://github.com/ixxi-mobility/elasticsearch-editdistance-scoring)**
>
> elasticsearch-editdistance-scoring - ElasticSearch script for scoring by edit distance (Levenstein). Molto alpha!

> <https://github.com/thomasheckmann/elasticsearch-hamming/blob/master/elasticsearch-hamming/src/main/java/dk/kolbeck/elastic/plugin/hamming/HammingDistanceScriptFactory.java>

---

<div class="post-metadata">

**Author:** ![rjernst](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/rjernst/32/6363_2.png) [@rjernst](https://discuss.elastic.co/u/rjernst)\
**Post date:** [August 26, 2017, 4:09pm UTC](https://discuss.elastic.co/t/elasticsearch-scripting-engine/98424/2 "2017-08-26T16:09:53Z")

</div>

The scripting documentation that you link is the defacto example. It shows all the boiler plate necessary for a ScriptEngine, as well as the details of accessing eg Lucene internals (PostingsEnum in this case). What additionally are you looking for?

---

<div class="post-metadata">

**Author:** ![prasperl](https://avatars.discourse-cdn.com/v4/letter/p/df788c/32.png) [@prasperl](https://discuss.elastic.co/u/prasperl)\
**Post date:** [August 26, 2017, 4:39pm UTC](https://discuss.elastic.co/t/elasticsearch-scripting-engine/98424/3 "2017-08-26T16:39:19Z")

</div>

Thanks @rjernst..Where could I find more information about all the methods and function?For example,leafscorefunction.I think what I am trying to find is something like a developer guide

---

<div class="post-metadata">

**Author:** ![rjernst](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/rjernst/32/6363_2.png) [@rjernst](https://discuss.elastic.co/u/rjernst)\
**Post date:** [August 26, 2017, 4:58pm UTC](https://discuss.elastic.co/t/elasticsearch-scripting-engine/98424/4 "2017-08-26T16:58:28Z")

</div>

You'll need to look at the javadocs and sourcecode, both for Elasticsearch and Lucene. Unfortunately there is no developer guide (yet). It is something that I personally would like to see as well, but our plugin api is still very much in flux, and until it is stabilized, working on such a guide would result in a lot of churn.

---

<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 23, 2017, 4:58pm UTC](https://discuss.elastic.co/t/elasticsearch-scripting-engine/98424/5 "2017-09-23T16:58:34Z")

</div>

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