es的图形管理工具kibana
kibana对es的一些基本操作:
1、查看index
点击如图菜单可以到es的index 管理界面:
点击一条记录可以看到Index的具体信息如下:
如上图所示,可以看到索引的基本信息,也可以对删除、关闭索引等。
2、执行命令行
点击Dev Tools 菜单进入到console界面可以执行命令
3、常用命令
create index:
命令:
PUT index_1
运行结果:
#! Deprecation: the default number of shards will change from [5] to [1] in 7.0.0; if you wish to continue using the default of [5] shards, you must manage this on the create index request or with an index template
{
"acknowledged" : true,
"shards_acknowledged" : true,
"index" : "index_1"
}
delete index:
命令:
DELETE index_1
运行结果:
{
"acknowledged" : true
}
create document with id:
命令:
PUT /index_1/log/123
{
"title":"圣诞节惊喜",
"text":"这个圣诞节很特殊",
"data":"2019/03/22"
}
运行结果:
{
"_index" : "index_1",
"_type" : "log",
"_id" : "123",
"_version" : 1,
"result" : "created",
"_shards" : {
"total" : 2,
"successful" : 1,
"failed" : 0
},
"_seq_no" : 0,
"_primary_term" : 1
}
查询:
命令:
GET index_1/_search
{
"query":{
"match":{
"title":"圣"
}
}
}
运行结果:
{
"took" : 0,
"timed_out" : false,
"_shards" : {
"total" : 5,
"successful" : 5,
"skipped" : 0,
"failed" : 0
},
"hits" : {
"total" : 1,
"max_score" : 0.2876821,
"hits" : [
{
"_index" : "index_1",
"_type" : "log",
"_id" : "123",
"_score" : 0.2876821,
"_source" : {
"title" : "圣诞节惊喜",
"text" : "这个圣诞节很特殊",
"data" : "2019/03/22"
}
}
]
}
}
设置Ik分词:
index:index1
type:fulltext
doc:content
命令:
PUT index1
{
"mappings": {
"fulltext":{
"properties":{
"content":{
"type":"text",
"analyzer":"ik_max_word",
"search_analyzer":"ik_max_word"
}
}
}
}
}
如果出现以下错误:
{
"error": {
"root_cause": [
{
"type": "resource_already_exists_exception",
"reason": "index [index1/P6h5Hz4pQ4mhQfetR9wh8A] already exists",
"index_uuid": "P6h5Hz4pQ4mhQfetR9wh8A",
"index": "index1"
}
],
"type": "resource_already_exists_exception",
"reason": "index [index1/P6h5Hz4pQ4mhQfetR9wh8A] already exists",
"index_uuid": "P6h5Hz4pQ4mhQfetR9wh8A",
"index": "index1"
},
"status": 400
}
需要删除索引,再重新建立。