# Inherit from AbstractSearchScript in ScriptEngine

**URL:** <https://discuss.elastic.co/t/inherit-from-abstractsearchscript-in-scriptengine/103117>\
**Category:** Elasticsearch\
**Created:** [October 7, 2017, 2:49pm UTC](https://discuss.elastic.co/t/inherit-from-abstractsearchscript-in-scriptengine/103117 "2017-10-07T14:49:28Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![ItamarBenjamin](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/itamarbenjamin/32/22863_2.png) [@ItamarBenjamin](https://discuss.elastic.co/u/ItamarBenjamin)\
**Post date:** [October 7, 2017, 2:49pm UTC](https://discuss.elastic.co/t/inherit-from-abstractsearchscript-in-scriptengine/103117/1 "2017-10-07T14:49:28Z")

</div>

Hi,  
I'm trying to write a custom script engine for elastic search. I noticed elastic comes with AbstractSearchScript class I can extend in order to tune the search. However, this class has a private protected method setLookup which isn't called explicitly from the elastic search core code, and cannot be called from the plugin itself - when I call it I get IllegalAccessException which makes sense since the class and my script are loaded with different class loaders.

so - who calls it? all methods in AbstractSearchScript are using the lookup variable set by this function, so it is basically unusable for me now.

---

<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:** [October 9, 2017, 5:14pm UTC](https://discuss.elastic.co/t/inherit-from-abstractsearchscript-in-scriptengine/103117/2 "2017-10-09T17:14:53Z")

</div>

You should ignore AbstractSearchScript as it has been removed in 6.0. Instead, [create your own script engine](https://www.elastic.co/guide/en/elasticsearch/reference/5.6/modules-scripting-engine.html).

---

<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:** [November 6, 2017, 5:15pm UTC](https://discuss.elastic.co/t/inherit-from-abstractsearchscript-in-scriptengine/103117/3 "2017-11-06T17:15:23Z")

</div>

Closed on November 6, 2017, 5:15pm UTC

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