# Cannot execute update by script

**URL:** https://discuss.elastic.co/t/cannot-execute-update-by-script/108795
**Category:** Elasticsearch
**Created:** [November 22, 2017, 9:25pm UTC](https://discuss.elastic.co/t/cannot-execute-update-by-script/108795 "2017-11-22T21:25:47Z")
**Posts on this page:** 2
**Page:** 1

<div class="post-metadata">

### Author: ![Marek](https://avatars.discourse-cdn.com/v4/letter/m/b2d939/32.png) [@Marek](https://discuss.elastic.co/u/Marek)
#### Post date: [November 22, 2017, 9:25pm UTC](https://discuss.elastic.co/t/cannot-execute-update-by-script/108795/1 "2017-11-22T21:25:48Z")

</div>

I am having a problem with this simple update:

[http://localhost:9200/post\_elastic/AV\_e3-gqARzXw\_Stq0-5/\_update](http://localhost:9200/post_elastic/AV_e3-gqARzXw_Stq0-5/_update)

```
{
    "script" : {
        "inline": "ctx._source.likes += 1",
        "lang": "painless"
    }
}

```

This leads to:

```
{
    "error": {
        "root_cause": [
            {
                "type": "remote_transport_exception",
                "reason": "[172.19.0.3][172.19.0.3:9300][indices:data/write/update[s]]"
            }
        ],
        "type": "illegal_argument_exception",
        "reason": "failed to execute script",
        "caused_by": {
            "type": "script_exception",
            "reason": "compile error",
            "script_stack": [],
            "script": "ctx._source.likes += 1",
            "lang": "painless",
            "caused_by": {
                "type": "runtime_exception",
                "reason": "java.lang.ClassNotFoundException: org.elasticsearch.painless.PainlessError"
            }
        }
    },
    "status": 400
}

```

The field to be incremented is an integer.  
"likes": {  
"type": "integer"  
},

---

<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: [December 20, 2017, 9:25pm UTC](https://discuss.elastic.co/t/cannot-execute-update-by-script/108795/2 "2017-12-20T21:25:59Z")

</div>

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