Update field in document failed


(Mateusz) #1

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 ?


(Alexander Reelsen) #2

hey,

you need to use

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

the order is important.

--Alex


(Mateusz) #3

Thank YOU!


(system) #4

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