1.创建索引
索引名必须小写,默认一个所以五个分片,一个副本,也可以通过参数指定:3个分片,一个副本
PUT test1
{
"settings":{
"number_of_shards":3,
"number_of_replicas":1
}
}
2.删除索引
DELETE test1
3.增加索引文档
PUT blog/article/1
{
"title":"java虚拟机 ",
"reply":18
}
4.获取文档
GET blog/article/1
5.更新文档 reply=30
POST blog/article/1/_update
{
"script": {
"inline": "ctx._source.reply=30"
}
}
6.更新文档 reply的值+4
POST blog/article/1/_update
{
"script": {
"inline": "ctx._source.reply+=params.inc",
"lang":"painless",
"params": {
"inc":4
}
}
}
7.删除文档
DELETE blog/article/1