# Pyes API/documentation on using Update API

**URL:** <https://discuss.elastic.co/t/pyes-api-documentation-on-using-update-api/9191>\
**Category:** Elasticsearch\
**Created:** [September 28, 2012, 10:50pm UTC](https://discuss.elastic.co/t/pyes-api-documentation-on-using-update-api/9191 "2012-09-28T22:50:55Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![es\_learner](https://avatars.discourse-cdn.com/v4/letter/e/8dc957/32.png) [@es\_learner](https://discuss.elastic.co/u/es_learner)\
**Post date:** [September 28, 2012, 10:50pm UTC](https://discuss.elastic.co/t/pyes-api-documentation-on-using-update-api/9191/1 "2012-09-28T22:50:55Z")

</div>

So I read up a bit more on the Update API - [http://www.elasticsearch.org/guide/reference/api/update.html](http://www.elasticsearch.org/guide/reference/api/update.html)

But I'm lost in finding pyes API docs for the same. The above link did mention 'update operation supports similar parameters as the index API' but how I do I pass in the ctx and params used in the curl examples.

Any pointers please?

---

<div class="post-metadata">

**Author:** ![Radu\_Gheorghe1](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/radu_gheorghe1/32/2688_2.png) [@Radu\_Gheorghe1](https://discuss.elastic.co/u/Radu_Gheorghe1)\
**Post date:** [October 1, 2012, 5:58am UTC](https://discuss.elastic.co/t/pyes-api-documentation-on-using-update-api/9191/2 "2012-10-01T05:58:44Z")

</div>

Hey,

AFAIK, there is an "update" function in pyes, but it's not using the Update  
API. Here's the relevant snip from

> <https://github.com/aparo/pyes/blob/master/pyes/es.py>

```
def update(self, extra_doc, index, doc_type, id, querystring_args=None,
           update_func=None, attempts=2):
    """
    Update an already indexed typed JSON document.

    The update happens client-side, i.e. the current document is retrieved,
    updated locally and finally pushed to the server. This may repeat up to
    ``attempts`` times in case of version conflicts.

    :param update_func: A callable ``update_func(current_doc, extra_doc)``
        that computes and returns the updated doc. Alternatively it may
        update ``current_doc`` in place and return None. The default
        ``update_func`` is ``dict.update``.

    :param attempts: How many times to retry in case of version conflict.
    """

```

So you can use that, but I think it would be risky to use it if you have  
multiple processes/threads.

On Saturday, September 29, 2012 1:50:58 AM UTC+3, es\_learner wrote:

> So I read up a bit more on the Update API -  
> [Elasticsearch Platform — Find real-time answers at scale | Elastic](http://www.elasticsearch.org/guide/reference/api/update.html)
> 
> But I'm lost in finding pyes API docs for the same.
> 
> Any pointers please?

--

---

<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, 3:10am UTC](https://discuss.elastic.co/t/pyes-api-documentation-on-using-update-api/9191/3 "2017-07-06T03:10:40Z")

</div>


