# Preloaded Script Field Failure

**URL:** <https://discuss.elastic.co/t/preloaded-script-field-failure/5330>\
**Category:** Elasticsearch\
**Created:** [September 7, 2011, 11:59pm UTC](https://discuss.elastic.co/t/preloaded-script-field-failure/5330 "2011-09-07T23:59:50Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![kikster](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/kikster/32/3117_2.png) [@kikster](https://discuss.elastic.co/u/kikster)\
**Post date:** [September 7, 2011, 11:59pm UTC](https://discuss.elastic.co/t/preloaded-script-field-failure/5330/1 "2011-09-07T23:59:50Z")

</div>

I have a filtered, custom\_score query that uses a pre-loaded script to  
score documents. Here's a gist of it:

> <https://gist.github.com/cdolivares/1202096>

However, every time I run the query elasticsearch returns this error:

> <https://gist.github.com/cdolivares/1202208>

I have a script called scriptscore.mvel in /config/scripts. I'm using  
elasticsearch 17.6. When I pass in a script expression inline, it  
works great. Any idea why this would be happening?

---

<div class="post-metadata">

**Author:** ![kimchy](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/kimchy/32/44952_2.png) [@kimchy](https://discuss.elastic.co/u/kimchy)\
**Post date:** [September 8, 2011, 5:44pm UTC](https://discuss.elastic.co/t/preloaded-script-field-failure/5330/2 "2011-09-08T17:44:17Z")

</div>

Can you gist hte mvel script, and a gist for something that init a node with  
some data and executes the offending search request? Looked at the failure,  
strange one...

On Thu, Sep 8, 2011 at 2:59 AM, Chris [christopherdavidolivares@gmail.com](mailto:christopherdavidolivares@gmail.com)wrote:

> I have a filtered, custom\_score query that uses a pre-loaded script to  
> score documents. Here's a gist of it:
> 
> [Custom Script Query · GitHub](https://gist.github.com/1202096)
> 
> However, every time I run the query elasticsearch returns this error:
> 
> [gist:1202208 · GitHub](https://gist.github.com/1202208)
> 
> I have a script called scriptscore.mvel in /config/scripts. I'm using  
> elasticsearch 17.6. When I pass in a script expression inline, it  
> works great. Any idea why this would be happening?

---

<div class="post-metadata">

**Author:** ![kikster](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/kikster/32/3117_2.png) [@kikster](https://discuss.elastic.co/u/kikster)\
**Post date:** [September 11, 2011, 12:07am UTC](https://discuss.elastic.co/t/preloaded-script-field-failure/5330/3 "2011-09-11T00:07:59Z")

</div>

Hey Shay,

I was able to pinpoint the term that was causing the error, but I'm  
not sure what its value was on return time. I've extracted the  
portion of my script that causes into this gist.

> <https://gist.github.com/cdolivares/1208980>

When I simply return integers/floats from the script, everything works  
fine. Maybe somehow this term is returning a nulled out value that  
causes the failure?

Along the same lines, is there an effective way to debug preloaded  
scripts in elasticsearch? I basically have to debug by trial and  
error now.

Thanks for the help!

On Sep 8, 10:44 am, Shay Banon [kim...@gmail.com](mailto:kim...@gmail.com) wrote:

> Can you gist hte mvel script, and a gist for something that init a node with  
> some data and executes the offending search request? Looked at the failure,  
> strange one...
> 
> On Thu, Sep 8, 2011 at 2:59 AM, Chris [christopherdavidoliva...@gmail.com](mailto:christopherdavidoliva...@gmail.com)wrote:
> 
> > I have a filtered, custom\_score query that uses a pre-loaded script to  
> > score documents. Here's a gist of it:
> 
> > [Custom Script Query · GitHub](https://gist.github.com/1202096)
> 
> > However, every time I run the query elasticsearch returns this error:
> 
> > [gist:1202208 · GitHub](https://gist.github.com/1202208)
> 
> > I have a script called scriptscore.mvel in /config/scripts. I'm using  
> > elasticsearch 17.6. When I pass in a script expression inline, it  
> > works great. Any idea why this would be happening?

---

<div class="post-metadata">

**Author:** ![kikster](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/kikster/32/3117_2.png) [@kikster](https://discuss.elastic.co/u/kikster)\
**Post date:** [September 11, 2011, 12:19am UTC](https://discuss.elastic.co/t/preloaded-script-field-failure/5330/4 "2011-09-11T00:19:47Z")

</div>

I was able to pinpoint the term that was causing the error, but I'm  
not sure what its value was on return time. I've extracted the  
portion of my script that causes the error into this gist.

> <https://gist.github.com/cdolivares/1208980>

When I simply return integers/floats from the script, everything works  
fine. Maybe this term is returning a nulled out value that  
causes the failure?

Along the same lines, is there an effective way to debug preloaded  
scripts in elasticsearch? I basically have to debug by trial and  
error now.

On Sep 8, 10:44 am, Shay Banon [kim...@gmail.com](mailto:kim...@gmail.com) wrote:

> Can you gist hte mvel script, and a gist for something that init a node with  
> some data and executes the offending search request? Looked at the failure,  
> strange one...
> 
> On Thu, Sep 8, 2011 at 2:59 AM, Chris [christopherdavidoliva...@gmail.com](mailto:christopherdavidoliva...@gmail.com)wrote:
> 
> > I have a filtered, custom\_score query that uses a pre-loaded script to  
> > score documents. Here's a gist of it:
> 
> > [Custom Script Query · GitHub](https://gist.github.com/1202096)
> 
> > However, every time I run the query elasticsearch returns this error:
> 
> > [gist:1202208 · GitHub](https://gist.github.com/1202208)
> 
> > I have a script called scriptscore.mvel in /config/scripts. I'm using  
> > elasticsearch 17.6. When I pass in a script expression inline, it  
> > works great. Any idea why this would be happening?

---

<div class="post-metadata">

**Author:** ![kimchy](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/kimchy/32/44952_2.png) [@kimchy](https://discuss.elastic.co/u/kimchy)\
**Post date:** [September 11, 2011, 10:46am UTC](https://discuss.elastic.co/t/preloaded-script-field-failure/5330/5 "2011-09-11T10:46:17Z")

</div>

On Sun, Sep 11, 2011 at 3:07 AM, Chris  
[christopherdavidolivares@gmail.com](mailto:christopherdavidolivares@gmail.com)wrote:

> Hey Shay,
> 
> I was able to pinpoint the term that was causing the error, but I'm  
> not sure what its value was on return time. I've extracted the  
> portion of my script that causes into this gist.
> 
> [gist:1208980 · GitHub](https://gist.github.com/1208980)
> 
> When I simply return integers/floats from the script, everything works  
> fine. Maybe somehow this term is returning a nulled out value that  
> causes the failure?

Which term are you referring to? The result of the script? It will not cause  
the failure you provided before. A simple recreation would really help.

> Along the same lines, is there an effective way to debug preloaded  
> scripts in elasticsearch? I basically have to debug by trial and  
> error now.

Not sure what you mean by debug? debug prints? actual debugger?

> Thanks for the help!
> 
> On Sep 8, 10:44 am, Shay Banon [kim...@gmail.com](mailto:kim...@gmail.com) wrote:
> 
> > Can you gist hte mvel script, and a gist for something that init a node  
> > with  
> > some data and executes the offending search request? Looked at the  
> > failure,  
> > strange one...
> > 
> > On Thu, Sep 8, 2011 at 2:59 AM, Chris \<  
> > [christopherdavidoliva...@gmail.com](mailto:christopherdavidoliva...@gmail.com)\>wrote:
> > 
> > > I have a filtered, custom\_score query that uses a pre-loaded script to  
> > > score documents. Here's a gist of it:
> > 
> > > [Custom Script Query · GitHub](https://gist.github.com/1202096)
> > 
> > > However, every time I run the query elasticsearch returns this error:
> > 
> > > [gist:1202208 · GitHub](https://gist.github.com/1202208)
> > 
> > > I have a script called scriptscore.mvel in /config/scripts. I'm using  
> > > elasticsearch 17.6. When I pass in a script expression inline, it  
> > > works great. Any idea why this would be happening?

---

<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:** [July 6, 2017, 3:54am UTC](https://discuss.elastic.co/t/preloaded-script-field-failure/5330/6 "2017-07-06T03:54:50Z")

</div>


