es的简单操作

### 在kibana中console进行操作
### es是restful风格
### 查询所有
GET /*

### 删除所有
DELETE /*

### 进行分词
GET /_analyze
{
  "analyzer": "ik_max_word",
  "text": "我爱中国"
}
#结果
{
  "tokens" : [
    {
      "token" : "我",
      "start_offset" : 0,
      "end_offset" : 1,
      "type" : "CN_CHAR",
      "position" : 0
    },
    {
      "token" : "爱",
      "start_offset" : 1,
      "end_offset" : 2,
      "type" : "CN_CHAR",
      "position" : 1
    },
    {
      "token" : "中国",
      "start_offset" : 2,
      "end_offset" : 4,
      "type" : "CN_WORD",
      "position" : 2
    }
  ]
}

### 数据库 与 es 对比
数据库:库     表    数据    字段
es:   索引   类型   数据    属性(索引与类型一对一)


### 查看所有索引
GET _cat/indices?v

### 创建索引
PUT test1/type1/1(如不填写,会自动生成uuid值)
{
  "name":"zs",
  "age":18
}

### 查看单个索引
GET test1/type1/1

PUT test2/type2/1
{
  "color":"red",
  "height":15
}

### 删除索引
DELETE /test2
posted @ 2023-04-12 22:16  Bre-eZe  阅读(13)  评论(0)    收藏  举报