# Mvel script\_fields error

**URL:** <https://discuss.elastic.co/t/mvel-script-fields-error/18218>\
**Category:** Elasticsearch\
**Created:** [June 19, 2014, 6:31pm UTC](https://discuss.elastic.co/t/mvel-script-fields-error/18218 "2014-06-19T18:31:15Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![Neeraj\_Makam](https://avatars.discourse-cdn.com/v4/letter/n/94ad74/32.png) [@Neeraj\_Makam](https://discuss.elastic.co/u/Neeraj_Makam)\
**Post date:** [June 19, 2014, 6:31pm UTC](https://discuss.elastic.co/t/mvel-script-fields-error/18218/1 "2014-06-19T18:31:15Z")

</div>

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](mailto: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](https://groups.google.com/d/msgid/elasticsearch/f12e0805-4f17-41a1-b436-f6c3daf5b329%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, 1:21am UTC](https://discuss.elastic.co/t/mvel-script-fields-error/18218/2 "2017-07-06T01:21:07Z")

</div>


