The problem with MVEL that you can't redefine defined function in a script 
instance. Script class instantiates once the query starts, and then it's 
executing it again and again. MVEL is bad for complex scripting.
Yes, you could use groovy,and should :)

I found a good way to use it with the next code: 

*import* groovy.lang.Script
*class* MyScript *extends* Script {
  *def* run() {
    // your code is here, also binded variables should be available here
  }
}

So how it works:
1. Groovy compiles this script and put to class cache.
2. One each query MyScript instance is created (on per node)
3. On each document run() method is executed (It should provide different 
return values for filter script, score script, sort script, script fields)

Alex

On Wednesday, August 27, 2014 5:50:11 PM UTC+3, k...@stylelabs.com wrote:
>
> Hello
>
> We are executing some concurrent updates on the same document using an 
> MVEL script together with some parameters. 
> The MVEL script contains some functions such as "addRelations" etc but 
> there is no sign of duplicate functions.
>
> ES throws the following error:
>
> [John Kafka][inet[/10.12.1.219:9300]][update]]; nested: 
> ElasticsearchIllegalArgumentException[failed to execute script]; nested: 
> *CompileException*[[Error: *duplicate function: addRelations*]
> [Near : {... def addRelations(relationNode, ....}]
>              ^
> [Line: 1, Column: 1]
>
> ES Version 1.3.2
>
> If the updates are executed sequentially there is no error/problem with 
> the MVEL script.
>
> Any idea's?
>
> Best Regards,
> Kristof
>

-- 
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+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/elasticsearch/e549c53b-90ae-41ca-b106-5c6e812417f7%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to