Update field in document failed

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 ?

hey,

you need to use

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

the order is important.

--Alex

1 Like

Thank YOU!

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