简体   繁体   中英

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). 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 . An example of the mapping for fieldname "CATEGORY":

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

In Kibana this works fine as I can select "fieldname.keyword" when creating visualizations. 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".

Can anyone give any insight as to why the keyword field is not being recognized in 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. Thanks!

I found the answer to my question here: 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.

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.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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