快捷搜索:  汽车  科技

elasticsearch详细教程:Elasticsearch 术语介绍和CRUD实际操作入门

elasticsearch详细教程:Elasticsearch 术语介绍和CRUD实际操作入门Read 读取 GET /index/type/idCreate 创建 PUT /index/type/id(data)显示集群详细信息。启动Kibana,访问http://localhost:5601,点击Dev Tools 菜单项。CRUD 基本操作

显示集群中有3个节点。

http://localhost:9200/_cat/nodes?v

显示标题信息,其中 * 表示为主节点。

http://localhost:9200/_cluster/stats

显示集群详细信息。

elasticsearch详细教程:Elasticsearch 术语介绍和CRUD实际操作入门(1)

三、Elasticsearch中CRUD实际操作

启动Kibana,访问http://localhost:5601,点击Dev Tools 菜单项。

elasticsearch详细教程:Elasticsearch 术语介绍和CRUD实际操作入门(2)

CRUD 基本操作

Create 创建 PUT /index/type/id(data)

Read 读取 GET /index/type/id

Update 更新 POST /index/type/id/_update(doc)

Delete 删除 DELETE /index/type/id

(1)输入POST 脚本,点击执行按钮,查看输出结果。

elasticsearch详细教程:Elasticsearch 术语介绍和CRUD实际操作入门(3)

(2)查询操作 GET

GET /accounts/person/1 获取查询结果

elasticsearch详细教程:Elasticsearch 术语介绍和CRUD实际操作入门(4)

(3)更新操作 POST

POST /accounts/person/1/_update

{

"doc":{

"lastname":"li"

}

}

再次执行查询操作GET,发现结果已经更新成功。

elasticsearch详细教程:Elasticsearch 术语介绍和CRUD实际操作入门(5)

猜您喜欢: