1.添加索引app
http://192.168.15.38:9200/[索引名] http://192.168.15.38:9200/[索引名]/[類型] 請求方式:POST
2.添加文檔post
請求方式:POST插件
http://192.168.15.38:9200/[索引名]/[類型] 要添加的數據: { "key":"value", ... }
例如:code
http://192.168.15.38:9200/user/basic_info/ { "name":"黎明", "age":33, "address":"中國香港", "email":"liming@163.com" }
3.修改文檔索引
請求方式:PUT文檔
http://192.168.15.38:9200/[索引名]/[類型]/[要修改的id] 要修改的數據: { "key":"value", ... }
例如:get
http://192.168.15.38:9200/user/basic_info/c3NxK2EBesajLJwX-TE5/ { "name":"劉德華", "age":31, "address":"中國香港-九龍", "email":"dehua@163.com" }
http://192.168.15.38:9200/[索引名]/[類型]/[要刪除的id]
例如:it
http://192.168.15.38:9200/user/basic_info/c3NxK2EBesajLJwX-TE5/
5.查詢文檔class
請求方式:GETemail
http://192.168.15.38:9200/[索引名]/[類型]/[要查詢的id]
例如:
http://192.168.15.38:9200/user/basic_info/cnNwK2EBesajLJwXXjHl/
6.head插件增長索引映射
http://192.168.15.38:9200/student/
{ "mappings": { "first": { "properties": { "name": { "type": "keywords" }, "stu_no": { "type": "integer" }, "class_id": { "type": "integer" } } } } }
7.head插件查詢索引映射
http://192.168.15.38:9200/film/_mapping/smile {"properties":{"title":{"type":"text","analyzer":"smartcn"},"publishDate":{"type":"date"},"desc":{"type":"text","analyzer":"smartcn"},"director":{"type":"keyword"},"price":{"type":"float"}}}
請求方式:post
film:索引名
_mapping:表示索引映射 smile:類型
參數中定義了索引smile類型的結構