简体   繁体   English

Grafana无法在String字段上聚合,因为它无法识别Elasticsearch中的关键字字段

[英]Grafana cannot aggregate on String fields as it does not recognize keyword field in Elasticsearch

I have an Elasticsearch (5.1.2) data source and am visualizing the data in Kibana and Grafana (4.1.1). 我有一个Elasticsearch(5.1.2)数据源,并且正在Kibana和Grafana(4.1.1)中可视化数据。 For string values in my dataset I am using the keyword feature as described at https://www.elastic.co/guide/en/elasticsearch/reference/5.2/fielddata.html . 对于我的数据集中的字符串值,我正在使用关键字功能,如https://www.elastic.co/guide/en/elasticsearch/reference/5.2/fielddata.html中所述 An example of the mapping for fieldname "CATEGORY": 字段名称“ CATEGORY”的映射示例:

"CATEGORY": {
  "type": "text",
  "norms": false,
  "fields": {
    "keyword": {
      "type": "keyword"
     }
   }
 }

In Kibana this works fine as I can select "fieldname.keyword" when creating visualizations. 在Kibana中,这很好用,因为在创建可视化文件时我可以选择“ fieldname.keyword”。 However in Grafana it seems like the keyword field is not recognized, as I can only select "fieldname" when creating graphs, which displays the message "fielddata is disabled on text fields by default". 但是在Grafana中,关键字字段似乎无法识别,因为在创建图形时我只能选择“字段名称”,该图形显示消息“默认情况下,文本字段上的字段数据已禁用”。

Can anyone give any insight as to why the keyword field is not being recognized in Grafana? 任何人都无法对为何在Grafana中无法识别关键字字段有任何见解? Setting fielddata=true is an option too, however I would really prefer get it working using keyword due to the memory overhead associated with setting fielddata=true. 设置fielddata = true也是一个选项,但是由于与设置fielddata = true关联的内存开销,我真的更喜欢使用关键字使其工作。 Thanks! 谢谢!

I found the answer to my question here: http://www.mos-eisley.dk/display/it/Elasticsearch+Dashbord+in+Grafana . 我在这里找到了问题的答案: http : //www.mos-eisley.dk/display/it/Elasticsearch+Dashbord+in+Grafana You can ignore the parts about setting fieldname=true and instead just set it to query the fieldname.keyword when creating the template. 您可以忽略有关设置fieldname = true的部分,而仅在创建模板时将其设置为查询fieldname.keyword。

Just a quick note: Something that took me too long to realise is that when grouping by term, "fieldname.keyword" will not be available for selection in the drop down, so you simply have to type it in. 快速说明:我花了很长时间才意识到,按术语分组时,“ fieldname.keyword”将无法在下拉列表中进行选择,因此您只需键入即可。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM