【ElasticSearch】添加、更新、删除数据
======================================================================
1、添加
2、更新
3、删除
======================================================================
1、添加
PUT get-together/_doc/1 { "name": "Jim Green", "age": 28 }
2、更新
更新部分文档(必须存在)
POST get-together/_update/1 { "doc": { "name": "Alice Smith" } }
使用upsert更新或添加文档
POST get-together/_update/2 { "doc": { "name": "Alice Smith" }, "upsert": { "name": "Alice Smith", "age": 0 } }
通过脚本更新文档
POST get-together/_update/1 { "script": { "source": "ctx._source.age = params.incnum", "params": { "incnum": 13 } } }
3、删除
DELETE get-together/_doc/1
原文:https://www.cnblogs.com/yangchongxing/p/14425834.html