# ES update API with script via Python client

**URL:** <https://discuss.elastic.co/t/es-update-api-with-script-via-python-client/40196>\
**Category:** Elasticsearch\
**Created:** [January 27, 2016, 7:27am UTC](https://discuss.elastic.co/t/es-update-api-with-script-via-python-client/40196 "2016-01-27T07:27:24Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![Patrick\_Lam](https://avatars.discourse-cdn.com/v4/letter/p/ed8c4c/32.png) [@Patrick\_Lam](https://discuss.elastic.co/u/Patrick_Lam)\
**Post date:** [January 27, 2016, 7:27am UTC](https://discuss.elastic.co/t/es-update-api-with-script-via-python-client/40196/1 "2016-01-27T07:27:24Z")

</div>

Hi,

I'm trying to use the Update API via the Python client on ES 2.1.1 and I'm having trouble.

```auto
es.index(index='boston', doc_type='stem_map', id=111, body={'word': 'showing', 'counter': 29})
es.get(index='boston', doc_type='stem_map', id=111)

{'_id': '111',
 '_index': 'boston',
 '_source': {'counter': 29, 'word': 'showing'},
 '_type': 'stem_map',
 '_version': 1,
 'found': True}

```

```auto
upscript = {
    'script': {
        'inline': 'ctx._source.counter += count', 
        'params': {
            'count': 100
        }
    }
}

```

Then I tried both of the following:

```auto
es.update(index='boston', doc_type='stem_map', id=111, body=upscript)
es.update(index='boston', doc_type='stem_map', id=111, script=upscript)

```

I'm getting the following error:

```auto
RequestError: TransportError(400, 'illegal_argument_exception', '[John Walker][127.0.0.1:9300][indices:data/write/update[s]]')

```

Does anybody know what I'm doing wrong?

---

<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 5, 2017, 11:21pm UTC](https://discuss.elastic.co/t/es-update-api-with-script-via-python-client/40196/2 "2017-07-05T23:21:11Z")

</div>


