向现有文档elasticsearch添加其他属性 [英] Add additional attributes to an existing document elasticsearch

查看:106
本文介绍了向现有文档elasticsearch添加其他属性的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

如何在Elasticsearch索引中的现有文档中添加其他属性.

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"

将文档修改为

"user" : "kimchy",
"post_date" : "2009-11-15T14:12:12",
"message" : "trying out Elastic Search"
"new_attribute" :"new_value"

推荐答案

我认为使用更新api是可能的.检查一下:

I think it is possible with the update api. Check this :

https://www.elastic.co/guide/zh-CN/elasticsearch/reference/current/docs-update.html#_update_part_of_a_document

并向下滚动以向文档添加新字段".

and scroll down to "add a new field to the document".

致谢

这篇关于向现有文档elasticsearch添加其他属性的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆