Reputation: 791
How do I add additional attributes to an existing document in Elasticsearch index.
$ curl -XPUT 'http://localhost:9200/twitter/tweet/1' -d '{
"user" : "kimchy",
"post_date" : "2009-11-15T14:12:12",
"message" : "trying out Elastic Search"
}'
This would create a document in the index. How do I add an attribute to the document? Suppose
"new_attribute":"new_value"
which would modify the document as
"user" : "kimchy",
"post_date" : "2009-11-15T14:12:12",
"message" : "trying out Elastic Search"
"new_attribute" :"new_value"
Upvotes: 15
Views: 31397
Reputation: 571
I think it is possible with the update api. Check this :
and scroll down to "add a new field to the document".
Regards
Upvotes: 10
Reputation: 2818
I know this is an old post but i think it can be handy
POST /twitter/tweet/1/_update
{
"doc": {
"new_attribute":""
}
}
Upvotes: 8