# Update api using python

**URL:** <https://discuss.elastic.co/t/update-api-using-python/11194>\
**Category:** Elasticsearch\
**Created:** [March 18, 2013, 4:30pm UTC](https://discuss.elastic.co/t/update-api-using-python/11194 "2013-03-18T16:30:03Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![Eran\_Eidinger](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/eran_eidinger/32/44831_2.png) [@Eran\_Eidinger](https://discuss.elastic.co/u/Eran_Eidinger)\
**Post date:** [March 18, 2013, 4:30pm UTC](https://discuss.elastic.co/t/update-api-using-python/11194/1 "2013-03-18T16:30:03Z")

</div>

assuming i have the mapping:  
{ "my\_doctype" :  
{  
"\_timestamp" : { "enabled" : True },  
"properties":  
{  
"my\_set": { "type": "string", "index":"analyzed" },  
}  
}  
}

I am trying to use the update API to add an item to a list, making sure it does not exist yet (and not caring about the order in the list):  
curl -XPOST 'localhost:9200/test/my\_doctype/1/\_update' -d '{  
"script" : "ctx.\_source.my\_set = list(set(ctx.\_source.my\_set).add('new\_item'))",  
"lang" : "python"  
}'

This results in :  
{  
"error" : "ElasticSearchIllegalArgumentException[failed to execute script]; nested: ElasticSearchIllegalArgumentException[script\_lang not supported [python]]; ",  
"status" : 400  
}

my ES version is 0.20.4 and i tried using both elasticsearch-lang-python/1.1.0 and elasticsearch-lang-python/1.2.0 with the same outcome.

Also, is there a way to do what I asked without the python , using mvel instead?

---

<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, 2:46am UTC](https://discuss.elastic.co/t/update-api-using-python/11194/2 "2017-07-06T02:46:04Z")

</div>


