# How to update field inside nested document?

**URL:** https://discuss.elastic.co/t/how-to-update-field-inside-nested-document/119202
**Category:** Elasticsearch
**Created:** [February 9, 2018, 9:44am UTC](https://discuss.elastic.co/t/how-to-update-field-inside-nested-document/119202 "2018-02-09T09:44:00Z")
**Posts on this page:** 1
**Showing post:** 2

<div class="post-metadata">

### Author: ![Magnus\_Kessler](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/magnus_kessler/32/42001_2.png) [@Magnus\_Kessler](https://discuss.elastic.co/u/Magnus_Kessler)
#### Post date: [February 9, 2018, 10:30am UTC](https://discuss.elastic.co/t/how-to-update-field-inside-nested-document/119202/2 "2018-02-09T10:30:05Z")

</div>

Have a look at scripted updates in the [Update API](https://www.elastic.co/guide/en/elasticsearch/reference/current/docs-update.html#_scripted_updates).

```auto
POST tmp_test/doc/1/_update
{
  "script": {
    "lang": "painless",
    "source": "ctx._source.LineItem[0].CONumber = params.CONumber",
    "params": {
      "CONumber": "9876"
    }
  }
}

```

---

_[View the full topic](https://discuss.elastic.co/t/how-to-update-field-inside-nested-document/119202)._
