运行的环境在kibana里,请参考kibana安装
增
# 新建索引
PUT /product
# 插入内容
PUT /product/_doc/1
{
"name": "pig",
"desc": "delicious",
"price": 50,
"tags": [
"xingjiabi",
"fashao",
"buka"
]
}
# 插入内容
PUT /product/_doc/2
{
"name": "pig2",
"desc": "delicious2",
"price": 50,
"tags": [
"xingjiabi",
"fashao",
"buka"
]
}
删
DELETE product/_doc/1
改
# 修改1:更改部分内容
POST /product/_doc/1/_update
{
"doc":{
"price": 100
}
}
# 修改2:此⽅式会将id下的数据全部替换掉
PUT /product/_doc/1
{
"price": 250
}
查
# 查询全部
GET /product/_search
# 查询指定索引类型的内容
GET /product/_doc/1
# 查询指定类型的全部
GET /product/_doc/_search