一.数据:
PUT class_01
{
"mappings": {
"students": {
"properties": {
"age": {
"type": "long"
},
"birthday": {
"type": "date"
},
"sex": {
"type": "text",
"fields": {
"keyword": {
"type": "keyword",
"ignore_above": 256
}
}
},
"hobby": {
"type": "text",
"fields": {
"keyword": {
"type": "keyword",
"ignore_above": 256
}
}
},
"hobby_en": {
"type": "text",
"fields": {
"keyword": {
"type": "keyword",
"ignore_above": 256
}
}
},
"name": {
"type": "text",
"fields": {
"keyword": {
"type": "keyword",
"ignore_above": 256
}
}
},
"canteen_consumption_record": {
"type": "nested",
"properties": {
"time": {
"type": "date"
},
"value": {
"type": "double"
}
}
}
}
}
}
}
PUT class_01/students/1
{
"name":"张三",
"sex":"man",
"age":14,
"birthday":"1992-11-11T15:00:00",
"hobby":["篮球","足球"],
"hobby_en":["basketball","football"],
"stature":178,
"canteen_consumption_record": [
{
"time": "2019-12-29T12:00:00",
"value": 50
},
{
"time": "2019-12-29T12:13:00",
"value": 50
}]
}
PUT class_01/students/2
{
"name":"李四",
"sex":"women",
"age":15,
"birthday":"1991-02-11T14:00:00",
"hobby":["篮球","羽毛球"],
"hobby_en":["basketball","badminton"],
"canteen_consumption_record": [
{
"time": "2019-12-29T12:03:00",
"value": 50
}]
}
PUT class_01/students/3
{
"name":"王五",
"sex":"man",
"age":16,
"birthday":"1990-05-12T14:00:00",
"hobby":["游泳","乒乓球"],
"hobby_en":["swim","pingpong"],
"canteen_consumption_record": [
{
"time": "2019-12-29T13:02:00",
"value": 23.8
}]
}
PUT class_01/students/4
{
"name":"赵六",
"sex":"man",
"age":15,
"birthday":"1991-05-11T14:00:00",
"hobby":["游泳","篮球"],
"hobby_en":["swim","basketball"],
"canteen_consumption_record": [
{
"time": "2019-12-29T12:23:00",
"value": 48.2
}]
}
二.在kibana中创建索引
三.进入Visiable
四.创建视图
五.有很多视图可以选择,这里创建Line
在左边选择聚合查询
六.附加功能
视图页面的左上角有一些附加功能
save视图保存
share可以直接以短链接的方式分享给他人
inspect可以查看查询的query语句,返回的response的数据
七.inspect
八.视图目前当前的缺点
1.对于kibana目前提供的可视图模块中,比如Line等等,都是已经封装好的,想要实现自定的查询不行,比如各种script等。
2.解决上一个问题,视图当中提供了Vega的视图,支持自定义,但还要学习它的语法,可以参考:
kibana 7.x Visiable Vega使用