Duplicate function MVEL script

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+unsubscribe@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/elasticsearch/9ec7938a-434d-4610-9a53-5652765b4994%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

I'd port to groovy and try again. MVEL is on its way out and has some
stability issues anyway. Like, I really think it has some problems
compiling multiple MVEL scripts concurrently.

Nik

On Wed, Aug 27, 2014 at 10:50 AM, kd@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+unsubscribe@googlegroups.com.
To view this discussion on the web visit
https://groups.google.com/d/msgid/elasticsearch/9ec7938a-434d-4610-9a53-5652765b4994%40googlegroups.com
https://groups.google.com/d/msgid/elasticsearch/9ec7938a-434d-4610-9a53-5652765b4994%40googlegroups.com?utm_medium=email&utm_source=footer
.
For more options, visit https://groups.google.com/d/optout.

--
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.
To view this discussion on the web visit https://groups.google.com/d/msgid/elasticsearch/CAPmjWd1DQqvr8wePzAfTxTvxrk7TnGLi9VBx_4at3D%3DVHW_noQ%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.

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 :slight_smile:

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+unsubscribe@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.

Ok thanks for the info, we ported the mvel script to groovy and the
concurrent operations seem to succeed now :slight_smile:

On Wednesday, August 27, 2014 4:50:11 PM UTC+2, 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+unsubscribe@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/elasticsearch/27310183-8041-445c-b922-1bf80df3474c%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.