Kibana操纵ES基础

打印 上一主题 下一主题

主题 987|帖子 987|积分 2961

马上注册,结交更多好友,享用更多功能,让你轻松玩转社区。

您需要 登录 才可以下载或查看,没有账号?立即注册

x
废话少说,开干!!!!!!!!!!!!截图更清晰,复制在下面



  1. #================库操作===================
  2. #创建索引【相当于数据库的库】
  3. PUT /first_index
  4. #获取索引【相当于数据库的库】
  5. GET first_index
  6. #删除索引【相当于数据库的库】
  7. DELETE /first_index
  8. #================表操作===================
  9. #创建类型【相当于数据库的表,即创建表字段】
  10. POST /first_index/first_type
  11. {
  12.   "properties" : {
  13.     "id" : {"type" : "long"},
  14.     "username" : {"type" : "text"},
  15.     "password" : {"type" : "text"},
  16.     "age" : {"type" : "integer"}
  17.   }
  18. }
  19. #获取类型【相当于数据库的表,添加表字段name,索引一旦创建就不能更改,如果更改导出数据,创建索引,导入数据】
  20. POST /first_index/first_type
  21. {
  22.   "properties" : {
  23.     "id" : {"type" : "long"},
  24.     "name" : {"type" : "text"},
  25.     "password" : {"type" : "text"},
  26.     "age" : {"type" : "integer"}
  27.   }
  28. }
  29. #================行操作===================
  30. #获取行内容
  31. GET /first_index/first_type/10/_source
  32. #添加和修改【如果有id为10的数据就修改,如果没有就添加】
  33. POST /first_index/first_type/10
  34. {
  35.     "id" : 23,
  36.     "username" :"lisi" ,
  37.     "password" : "666",
  38.     "age" : 11
  39. }
  40. POST /first_index/first_type/11
  41. {
  42.     "id" : 11,
  43.     "username" :"111" ,
  44.     "password" : "111",
  45.     "age" : 11
  46. }
  47. POST /first_index/first_type/12
  48. {
  49.     "id" : 11,
  50.     "username" :"111" ,
  51.     "password" : "111",
  52.     "age" : 5
  53. }
  54. #删除行数据
  55. DELETE /first_index/first_type/11
  56. #================常用命令===================
  57. #获取所有的index【相当于数据库的库】,返回json格式
  58. GET /_cat/indices?format=json
  59. #获取所有的index【相当于数据库的库】,返回列表
  60. GET /_cat/indices?
  61. #获取所有的index【相当于数据库的表及表字段属性】
  62. GET first_index
  63. #获取所有的index【相当于表的行数据】
  64. GET /first_index/_search
  65. {
  66.   "query": {
  67.     "match_all": {}
  68.   }
  69. }
  70. #查询username是lisi的数据,不是模糊查询
  71. GET /first_index/_search
  72. {
  73.   "size": 2,
  74.   "query": {
  75.     "match": {
  76.       "username":"lisi"
  77.     }
  78.   }
  79. }
  80. #查询username包含li的数据,是模糊查询
  81. GET /first_index/_search
  82. {
  83.   "query": {
  84.     "query_string": {
  85.       "fields": ["username"],
  86.       "query": "*li*"
  87.     }
  88.   }
  89. }
  90. #查询age大于6的数据
  91. POST /first_index/_search
  92. {
  93.   "query": {
  94.     "range": {
  95.       "age": {
  96.         "gt": 6
  97.       }
  98.     }
  99.   }
  100. }
复制代码


免责声明:如果侵犯了您的权益,请联系站长,我们会及时删除侵权内容,谢谢合作!更多信息从访问主页:qidao123.com:ToB企服之家,中国第一个企服评测及商务社交产业平台。
回复

使用道具 举报

0 个回复

倒序浏览

快速回复

您需要登录后才可以回帖 登录 or 立即注册

本版积分规则

耶耶耶耶耶

金牌会员
这个人很懒什么都没写!
快速回复 返回顶部 返回列表