# Update field in document failed

**URL:** <https://discuss.elastic.co/t/update-field-in-document-failed/74235>\
**Category:** Elasticsearch\
**Created:** [February 7, 2017, 2:47pm UTC](https://discuss.elastic.co/t/update-field-in-document-failed/74235 "2017-02-07T14:47:16Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![matizgal](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/matizgal/32/8827_2.png) [@matizgal](https://discuss.elastic.co/u/matizgal)\
**Post date:** [February 7, 2017, 2:47pm UTC](https://discuss.elastic.co/t/update-field-in-document-failed/74235/1 "2017-02-07T14:47:16Z")

</div>

I've got

> {  
> "\_index" : "index",  
> "\_type" : "type",  
> "\_id" : "1",  
> "\_score" : 1.0,  
> "\_source" : {  
> "body" : {  
> "city" : "New York"  
> }  
> }  
> }

If I have update field "city" I used this function:

`curl -XPOST localhost:9200/index/type/1/_update -d '{"body":{ "doc" : {"city": "Tokio"}}}'`

if I finished i have this :

```
{
      "_index" : "index",
      "_type" : "type",
      "_id" : "1",
      "_score" : 1.0,
      "_source" : {
        "body" : {
          "city" : "New York"
        },
        "city" : "Tokio"
      }
    },

```

anybody know what I do wrong ?

---

<div class="post-metadata">

**Author:** ![spinscale](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/spinscale/32/25011_2.png) [@spinscale](https://discuss.elastic.co/u/spinscale)\
**Post date:** [February 7, 2017, 3:18pm UTC](https://discuss.elastic.co/t/update-field-in-document-failed/74235/2 "2017-02-07T15:18:17Z")

</div>

hey,

you need to use

```auto
{ "doc" : { "body" : { "city" : "Tokio" } }

```

the order is important.

--Alex

---

<div class="post-metadata">

**Author:** ![matizgal](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/matizgal/32/8827_2.png) [@matizgal](https://discuss.elastic.co/u/matizgal)\
**Post date:** [February 7, 2017, 3:28pm UTC](https://discuss.elastic.co/t/update-field-in-document-failed/74235/3 "2017-02-07T15:28:58Z")

</div>

Thank YOU!

---

<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:** [March 7, 2017, 3:28pm UTC](https://discuss.elastic.co/t/update-field-in-document-failed/74235/4 "2017-03-07T15:28:58Z")

</div>

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