granfana问题记录

1.grafana以elasticsearch为数据源,时间字段问题

  es 新建了索引后,日期类型默认是text类型。postman输入http://localhost:9200/index后,可以查看索引的具体类型。比如

 

 

 

 需要在程序里面设置下:

for (Field f2 : df2) {
                        if (f2.isAnnotationPresent(EsField.class)) {
                            // 获取注解
                            EsField declaredAnnotation2 = f2.getDeclaredAnnotation(EsField.class);
                            builder.startObject(f2.getName());
                            builder.field("type", declaredAnnotation2.type().getType());
                            // keyword不需要分词
                            if (declaredAnnotation2.type() == FieldType.TEXT) {
                                builder.field("analyzer", declaredAnnotation2.analyzer().getType());
                            }
                            if (declaredAnnotation2.type() == FieldType.DATE) {
                                builder.field("format", "yyyy-MM-dd HH:mm:ss");
                            }
                            builder.endObject();
                        }
                    }

然后是使用kibana显示es数据问题。对kibana使用不是很熟悉。记录下创建的步骤

1.

 

 2.

 

 

 3.根据提示,next step ,最后创建成功就能展示了

 

 

 主要是使用kibana显示的时候,怎么能显示多行。需要进行设置:

 

 

 参考:https://blog.csdn.net/wlei0618/article/details/123712605

2.grafana绘制图表时候,如何在time series时候展示多行数据?

  使用granfa时候,es的数据使用 time series ,有多个数据就能显示。另外就是多用模板,看模板怎么设置的,照抄模板就行

es模板下载地址:

https://grafana.com/grafana/dashboards/?dataSource=elasticsearch

 

3.分组时候展示 

Data does not have a time field

 字段在特定的试图下无数据

 

posted @ 2023-02-17 11:02  Doyourself!  阅读(148)  评论(0编辑  收藏  举报