在 ES 7 中新增索引:
使用 _update
更新文档
# 请求1
POST student/_doc/2
{
"name": "李四"
}
# 请求2: 新增 age
POST student/_doc/2/_update
{
"doc": {
"age": 10
}
}
# 查询
GET student/_doc/2
# 查询结果
{
"_index" : "student",
"_type" : "_doc",
"_id" : "2",
"_version" : 6,
"_seq_no" : 6,
"_primary_term" : 1,
"found" : true,
"_source" : {
"name" : "李四",
"age" : 10
}
}