# Accessing script file in script\_score throws exception

**URL:** <https://discuss.elastic.co/t/accessing-script-file-in-script-score-throws-exception/23420>\
**Category:** Elasticsearch\
**Created:** [April 27, 2015, 3:00pm UTC](https://discuss.elastic.co/t/accessing-script-file-in-script-score-throws-exception/23420 "2015-04-27T15:00:06Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![kmrdiscuss](https://avatars.discourse-cdn.com/v4/letter/k/db5fbb/32.png) [@kmrdiscuss](https://discuss.elastic.co/u/kmrdiscuss)\
**Post date:** [April 27, 2015, 3:00pm UTC](https://discuss.elastic.co/t/accessing-script-file-in-script-score-throws-exception/23420/1 "2015-04-27T15:00:06Z")

</div>

Hi. I am running 1.4.4 and have the following script\_score block that  
executes a saved groovy script.  
"script\_score": {  
"params": {  
"b\_1": 1,  
"b\_2": 5  
},  
"script": "calculate-score.groovy",  
"lang":"groovy"  
}

When executed it returns the following exception.  
GroovyScriptExecutionException[MissingPropertyException[No such property:  
calculate for class: Script3]];

When the service is started it states the file calculate-score.groovy has  
been compiled.  
[2015-04-27 10:46:21,927][INFO][script] [XXXXXX]  
compiling script file [/etc/elasticsearch/scripts/calculate-score.groovy]

Any ideas?

Thanks in advance.

--  
You received this message because you are subscribed to the Google Groups "elasticsearch" group.  
To unsubscribe from this group and stop receiving emails from it, send an email to [elasticsearch+unsubscribe@googlegroups.com](mailto:elasticsearch+unsubscribe@googlegroups.com).  
To view this discussion on the web visit [https://groups.google.com/d/msgid/elasticsearch/71cfcacb-b632-4873-8d8e-e685d6edff85%40googlegroups.com](https://groups.google.com/d/msgid/elasticsearch/71cfcacb-b632-4873-8d8e-e685d6edff85%40googlegroups.com).  
For more options, visit [https://groups.google.com/d/optout](https://groups.google.com/d/optout).

---

<div class="post-metadata">

**Author:** ![kmrdiscuss](https://avatars.discourse-cdn.com/v4/letter/k/db5fbb/32.png) [@kmrdiscuss](https://discuss.elastic.co/u/kmrdiscuss)\
**Post date:** [April 27, 2015, 3:44pm UTC](https://discuss.elastic.co/t/accessing-script-file-in-script-score-throws-exception/23420/2 "2015-04-27T15:44:12Z")

</div>

I found the problem. Instead of "calculate-score.groovy" it should  
be "calculate-score".

On Monday, April 27, 2015 at 11:00:06 AM UTC-4, Kevin Reilly wrote:

> Hi. I am running 1.4.4 and have the following script\_score block that  
> executes a saved groovy script.  
> "script\_score": {  
> "params": {  
> "b\_1": 1,  
> "b\_2": 5  
> },  
> "script": "calculate-score.groovy",  
> "lang":"groovy"  
> }
> 
> When executed it returns the following exception.  
> GroovyScriptExecutionException[MissingPropertyException[No such property:  
> calculate for class: Script3]];
> 
> When the service is started it states the file calculate-score.groovy has  
> been compiled.  
> [2015-04-27 10:46:21,927][INFO][script] [XXXXXX]  
> compiling script file [/etc/elasticsearch/scripts/calculate-score.groovy]
> 
> Any ideas?
> 
> Thanks in advance.

--  
You received this message because you are subscribed to the Google Groups "elasticsearch" group.  
To unsubscribe from this group and stop receiving emails from it, send an email to [elasticsearch+unsubscribe@googlegroups.com](mailto:elasticsearch+unsubscribe@googlegroups.com).  
To view this discussion on the web visit [https://groups.google.com/d/msgid/elasticsearch/ddbb9916-8630-4261-9776-6b7f9b4fa4ec%40googlegroups.com](https://groups.google.com/d/msgid/elasticsearch/ddbb9916-8630-4261-9776-6b7f9b4fa4ec%40googlegroups.com).  
For more options, visit [https://groups.google.com/d/optout](https://groups.google.com/d/optout).

---

<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, 12:17am UTC](https://discuss.elastic.co/t/accessing-script-file-in-script-score-throws-exception/23420/3 "2017-07-06T00:17:34Z")

</div>


