es数据文档操作
1、创建(没有索引将会创建索引)
1.1创建
PUT /customer/_doc/1
{
"name": "John Doe"
}
1.2、批量创建
curl -H "Content-Type: application/json" -XPOST "localhost:9200/customer/_bulk?pretty&refresh" --data-binary "@accounts.json"
2、删除
DELETE /customer/_doc/1 --删除一个
DELETE /customer --删除索引数据
DELETE /customer* --通配符删除索引
3、修改
3.1、指明ID,进行全部提交,会覆盖
POST /customer/_doc/1
{
"name": "John Doe"
}
3.2:局部更新
POST /customer/1/_update
{"doc":{ "name": "John Doe" } }
OR
POST /customer/1/_update -d
{"script":"ctx._source. name="John Doe" " }
4、查询
GET /customer/_doc/1
以上是 es数据文档操作 的全部内容, 来源链接: utcz.com/z/515537.html