
#全局 *** 作
#查看集群健康状况
GET /_cat/health?v
#查看节点情况
GET /_cat/nodes?v
#查看各个索引状态
GET /_cat/indices?v
#创建索引 PUT 索引名?pretty
PUT /movie_index
#删除索引
DELETe /movie_index
#查看某索引的分片情况
GET /_cat/shards/movie_index
#创建文档
PUT /movie_index/movie/1
{ "id":100,
"name":"operation red sea",
"doubanScore":8.5,
"actorList":[
{"id":1,"name":"zhang yi"},
{"id":2,"name":"hai qing"},
{"id":3,"name":"zhang han yu"}
]
}
PUT /movie_index/movie/2
{
"id":200,
"name":"operation meigong river",
"doubanScore":8.0,
"actorList":[
{"id":3,"name":"zhang han yu"}
]
}
PUT /movie_index/movie/3
{
"id":300,
"name":"incident red sea",
"doubanScore":5.0,
"actorList":[
{"id":4,"name":"zhang san feng"}
]
}
#查询某个索引中全部文档 size控制个数
GET /movie_index/_search
{
"size":3
}
#根据文档ID查看文档
GET /movie_index/movie/1?pretty
#根据文档ID删除文档
DELETE /movie_index/movie/3
#删除后并不是真的删除,新增记录标记删除,需要合并
#也可以手动执行 进行合并触发
POST /_forcemerge
#put 对已经存在的文档进行替换
PUT /movie_index/movie/3
{
"id":300,
"name":"incident red sea",
"doubanScore":5.0,
"actorList":[
{"id":4,"name":"zhang cuishan"}
]
}
#post新增 *** 作,无法保证幂等性
#根据主键保证幂等性
#根据文档 id 更新文档 doc 固定写法
POST /movie_index/movie/3/_update?pretty
{
"doc": {"name":"wudang"}
}
#根据条件更新文档
POST /movie_index/_update_by_query
{
"query": {
"match":{
"actorList.id":1
}
},
"script": {
"lang": "painless",
"source":"for(int i=0;i
欢迎分享,转载请注明来源:内存溢出
微信扫一扫
支付宝扫一扫
评论列表(0条)