# Facing the cause "cannot evaluate script for expression StringQueryPredicate"

**URL:** <https://discuss.elastic.co/t/facing-the-cause-cannot-evaluate-script-for-expression-stringquerypredicate/183567>\
**Category:** Elasticsearch\
**Created:** [May 30, 2019, 3:19pm UTC](https://discuss.elastic.co/t/facing-the-cause-cannot-evaluate-script-for-expression-stringquerypredicate/183567 "2019-05-30T15:19:56Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![shubham-agarwal-ngi](https://avatars.discourse-cdn.com/v4/letter/s/4af34b/32.png) [@shubham-agarwal-ngi](https://discuss.elastic.co/u/shubham-agarwal-ngi)\
**Post date:** [May 30, 2019, 3:19pm UTC](https://discuss.elastic.co/t/facing-the-cause-cannot-evaluate-script-for-expression-stringquerypredicate/183567/1 "2019-05-30T15:19:56Z")

</div>

**Elasticsearch version** - 6.6.0  
**JVM version** -1.8  
**OS version** window server 2012 R2

I am running the below query using the xpack api  
{  
"query":"Select role as "role" , sum(customerincome ) as "sum\_customerincome" FROM message\_index where (Query('role:Son') OR Query('role:Wife')) GROUP BY role"  
}

but facing the below error,

"root\_cause": [  
{  
"type": "sql\_illegal\_argument\_exception",  
"reason": "Cannot evaluate script for expression StringQueryPredicate[role :Son,]"  
}  
]

please advice.

---

<div class="post-metadata">

**Author:** ![Andrei\_Stefan](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/andrei_stefan/32/47533_2.png) [@Andrei\_Stefan](https://discuss.elastic.co/u/Andrei_Stefan)\
**Post date:** [June 5, 2019, 5:57am UTC](https://discuss.elastic.co/t/facing-the-cause-cannot-evaluate-script-for-expression-stringquerypredicate/183567/2 "2019-06-05T05:57:07Z")

</div>

Hi @shubham-agarwal-ngi,  
The ES version you are using is rather old from SQL point of view (SQL went GA with ES 6.7.0). Many features and bug fixes went in it since 6.6.0. Would you be able to upgrade and try the query on a newer/newest version?

---

<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 3, 2019, 5:57am UTC](https://discuss.elastic.co/t/facing-the-cause-cannot-evaluate-script-for-expression-stringquerypredicate/183567/3 "2019-07-03T05:57:14Z")

</div>

This topic was automatically closed 28 days after the last reply. New replies are no longer allowed.
