# ES 6.5.0 why sql statement can't use sum?

**URL:** <https://discuss.elastic.co/t/es-6-5-0-why-sql-statement-cant-use-sum/159085>\
**Category:** Elasticsearch\
**Tags:** elastic-stack-sql\
**Created:** [December 3, 2018, 3:52am UTC](https://discuss.elastic.co/t/es-6-5-0-why-sql-statement-cant-use-sum/159085 "2018-12-03T03:52:22Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![Angela\_Hsieh](https://avatars.discourse-cdn.com/v4/letter/a/35a633/32.png) [@Angela\_Hsieh](https://discuss.elastic.co/u/Angela_Hsieh)\
**Post date:** [December 3, 2018, 3:52am UTC](https://discuss.elastic.co/t/es-6-5-0-why-sql-statement-cant-use-sum/159085/1 "2018-12-03T03:52:22Z")

</div>

Hi,

i use like in SQL at Elasticsearch 6.4.7 is OK, but upgrade to ES 6.5.0 , it can not working.....

> \_xpack/sql?format=txt  
> {"query":"SELECT star\_demo\_city,**sum(amt)** FROM demo\_test WHERE (star\_demo\_city like 'MEMPHIS%' or star\_demo\_dbo\_city like 'SHELBY%') group by star\_demo\_city "}

the error message :

> ```
> {
> "error": {
> "root_cause": [
> {
> "type": "sql_illegal_argument_exception",
> "reason": "Cannot evaluate script for expression LikePattern[MEMPHIS%,\u0000]"
> }
> ],
> "type": "sql_illegal_argument_exception",
> "reason": "Cannot evaluate script for expression LikePattern[MEMPHIS%,\u0000]"
> },
> "status": 500
> }
> 
> ```

if i delete "SUM(amt)" , the sql is working......

is there any way to solve it?

---

<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:** [December 3, 2018, 4:23pm UTC](https://discuss.elastic.co/t/es-6-5-0-why-sql-statement-cant-use-sum/159085/2 "2018-12-03T16:23:27Z")

</div>

Hi @Angela_Hsieh,  
Thank you for bringing this one up. Indeed, a bug. I've created a bug report: [https://github.com/elastic/elasticsearch/issues/36161](https://github.com/elastic/elasticsearch/issues/36161) and we'll look into it.

---

<div class="post-metadata">

**Author:** ![Angela\_Hsieh](https://avatars.discourse-cdn.com/v4/letter/a/35a633/32.png) [@Angela\_Hsieh](https://discuss.elastic.co/u/Angela_Hsieh)\
**Post date:** [December 4, 2018, 1:48am UTC](https://discuss.elastic.co/t/es-6-5-0-why-sql-statement-cant-use-sum/159085/3 "2018-12-04T01:48:47Z")

</div>

thanks for your reply, hope ES is better and better !

---

<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:** [January 1, 2019, 1:48am UTC](https://discuss.elastic.co/t/es-6-5-0-why-sql-statement-cant-use-sum/159085/4 "2019-01-01T01:48:50Z")

</div>

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