kibana新增查看更新删除es中的数据
warning:
这篇文章距离上次修改已过185天,其中的内容可能已经有所变动。
在Elasticsearch中,使用Kibana来新增、查看和删除数据通常涉及以下操作:
- 新增数据:使用Index API将文档添加到Elasticsearch索引中。
- 查看数据:使用Search API来查询和查看已存在的数据。
- 更新数据:使用Update API来更新已存在的文档。
- 删除数据:使用Delete API来删除文档。
以下是使用Kibana控制台执行这些操作的示例代码:
// 新增数据
POST /my_index/my_type
{
"title": "Document 1",
"content": "This is my first document"
}
// 查看数据
GET /my_index/_search
{
"query": {
"match": {
"title": "Document 1"
}
}
}
// 更新数据
POST /my_index/my_type/1/_update
{
"doc": {
"content": "Updated content for Document 1"
}
}
// 删除数据
DELETE /my_index/my_type/1
请注意,Elasticsearch 7.0+中已废弃使用类型(my\_type),因此在7.0+版本中,路径将变为POST /my_index/_doc/1
,更新操作将变为POST /my_index/_update/1
等。
在Kibana中,你可以在Dev Tools(开发工具)标签页中执行这些命令。首先,确保Elasticsearch服务正在运行,然后启动Kibana,并打开Dev Tools。在命令行界面中粘贴上述代码,并点击执行按钮。
评论已关闭