集群检查,文档CURD

版本(elasticsearch-7.4.2-windows,kibana-7.4.2-windows)

查看es的健康状态:GET _cat/health?v

查看es的索引:GET _cat/indices?v

 创建es索引  PUT test/

 删除es索引  DELETE text_index/

创建文档

PUT /ecommerce/_doc/4

{

  "name":"baiyao yagao",

  "desc":"baiyao meibai",

  "price":20,

  "producer":"baiyao producer",

  "tags":["baiyao","fangzhu"]

}

返回值:

## 注意 7.2版本与5.x版本创建语法不一样

    5.x:PUT /ecommerce/product/4

    7.2:PUT /ecommerce/_doc/4

    使用5.x的创建语法会出现如下提示:

文档更新有两种方式:

1.替换方式

PUT /ecommerce/_doc/4

{

  "name":"baiyao yagao",

  "desc":"baiyao meibai",

  "price":38,

  "producer":"baiyao producer",

  "tags":["baiyao","fangzhu"]


}

2.字段定义更新

POST /ecommerce/_update/4/

{

  "doc":{

    "price":21

  }

}

注意:与5.x版本语法不一样

5.x语法地段定义更新:

POST /ecommerce/4/_update

{

  "doc":{

    "price":21

  }

}

文档删除:DELETE /ecommerce/_doc/1

你可能感兴趣的:(集群检查,文档CURD)