curl -u 用户名:密码 -XGET http://192.168.1.162:9200/blog01/
http://192.168.1.162:9200/_cat/indices\?v
curl -u 用户名:密码 -XPUT http://192.168.1.162:9200/blog01/
http://192.168.1.162:9200/blog01/
PUT 索引名?pretty //创建索引并格式化输出
DELETE /索引名 //删除索引
//创建文档
API: PUT /索引名/类型名/文档id
注意:文档id和文档中的属性“id“ 不是一回事
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"}
]
}
//根据文档id查看
API:GET /索引名/类型名/文档id
GET /movie_index/movie/1?pretty
//查看所有文档
API:GET /索引名/_search
//批量创建
POST /movie_index/movie/_bulk
{"index":{"_id":66}}
{"id":300,"name":"incident red sea","doubanScore":5.0,"actorList":[{"id":4,"name":"zhang cuishan"}]}
{"index":{"_id":88}}
{"id":300,"name":"incident red sea","doubanScore":5.0,"actorList":[{"id":4,"name":"zhang cuishan"}]}
// 批量操作文档
POST /movie_index/movie/_bulk
{"update":{"_id":"66"}}
{"doc": { "name": "wudangshanshang" } }
{"delete":{"_id":"88"}}