Mvel script_fields error

Hi

I am running a script in mvel (scripted fields) that returns a computed
value by getting the payload information.
When i run the script, for the first few times i get the following error.
After executing the query 3-4 times, the mvel script starts working
perfectly fine till i change the parameter value.
Once changed, it again takes few attempts before it starts working.
(sometimes works on the first attempt, and sometimes 4th/5th attempt).
Is there any solution for this?

Error:
{
"error": "SearchPhaseExecutionException[Failed to execute phase
[query_fetch], all shards failed; shardFailures
{[SEKBsVXpS56AFe9Sshmxpg][codeindex][0]: ElasticsearchException[Bad type on
operand stack\nException Details:\n Location:\n
ASMAccessorImpl_3185728311403177607390.getValue(Ljava/lang/Object;Ljava/lang/Object;Lorg/elasticsearch/common/mvel2/integration/VariableResolverFactory;)Ljava/lang/Object;
@27: invokeinterface\n Reason:\n Type 'java/lang/Object' (current
frame, stack[1]) is not assignable to integer\n Current Frame:\n bci:
@27\n flags: { }\n locals: {
'ASMAccessorImpl_3185728311403177607390', 'java/lang/Object',
'java/lang/Object',
'org/elasticsearch/common/mvel2/integration/VariableResolverFactory' }\n
stack: { 'java/util/List', 'java/lang/Object' }\n Bytecode:\n 0000000:
2d12 0eb9 0014 0200 b900 1901 00c0 001b\n 0000010: 2ab4 001f 2c2d b900
2403 00b9 0028 0200\n 0000020: b0
\n]; nested: VerifyError[Bad type on operand stack\nException Details:\n
Location:\n
ASMAccessorImpl_3185728311403177607390.getValue(Ljava/lang/Object;Ljava/lang/Object;Lorg/elasticsearch/common/mvel2/integration/VariableResolverFactory;)Ljava/lang/Object;
@27: invokeinterface\n Reason:\n Type 'java/lang/Object' (current
frame, stack[1]) is not assignable to integer\n Current Frame:\n bci:
@27\n flags: { }\n locals: {
'ASMAccessorImpl_3185728311403177607390', 'java/lang/Object',
'java/lang/Object',
'org/elasticsearch/common/mvel2/integration/VariableResolverFactory' }\n
stack: { 'java/util/List', 'java/lang/Object' }\n Bytecode:\n 0000000:
2d12 0eb9 0014 0200 b900 1901 00c0 001b\n 0000010: 2ab4 001f 2c2d b900
2403 00b9 0028 0200\n 0000020: b0
\n]; }]",
"status": 500
}

I've tried ES 1.1.1, 1.2.1, Jre7 and Jre8 already. It still is the same.

--
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/f12e0805-4f17-41a1-b436-f6c3daf5b329%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.